Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pdsh build on MacOSX #96

Merged
merged 10 commits into from
Jun 27, 2017
29 changes: 21 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -19,20 +19,33 @@ cache:
- $HOME/local
- $HOME/.local

env:
- CC=gcc
- CC=clang
- CC=gcc-6
- CC=clang-3.8
matrix:
include:
- os: linux
env: CC=gcc
- os: linux
env: CC=clang
- os: linux
env: CC=gcc-6
- os: linux
env: CC=clang-3.8
- os: osx
language: c
osx_image: xcode8.3

script:
- export CFLAGS=-Werror
- scripts/travis-ci-deps.sh
- eval $(scripts/travis-ci-deps.sh --printenv)
- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
scripts/travis-ci-deps.sh;
eval $(scripts/travis-ci-deps.sh --printenv);
fi
- export CFLAGS="-Werror -Wno-error=deprecated-declarations"
- ./bootstrap
- ./configure --with-exec --with-ssh --with-mrsh --with-genders --with-dshgroups --with-netgroup --with-machines
- make -j 2 check

after_failure:
- cat tests/test-suite.log

before_deploy:
- make dist
- export TAG_URI="https://github.com/${TRAVIS_REPO_SLUG}/blob/${TRAVIS_TAG}"
2 changes: 1 addition & 1 deletion src/common/hostlist.c
Original file line number Diff line number Diff line change
@@ -466,7 +466,7 @@ static int host_prefix_end(const char *hostname)
static hostname_t hostname_create_with_suffix (const char *hostname, int idx)
{
hostname_t hn = NULL;
char *p = '\0';
char *p = "\0";

assert(hostname != NULL);

2 changes: 2 additions & 0 deletions src/common/macros.h
Original file line number Diff line number Diff line change
@@ -35,6 +35,8 @@
#include <pthread.h>
#endif

#include <stdbool.h>

#define LINEBUFSIZE 2048

#ifndef MAXHOSTNAMELEN
3 changes: 1 addition & 2 deletions src/modules/netgroup.c
Original file line number Diff line number Diff line change
@@ -119,12 +119,11 @@ static hostlist_t _read_netgroup (const char *group)
{
hostlist_t hl = NULL;
char *host, *user, *domain;
char buf[4096];
int rc;

setnetgrent (group);

while ((rc = getnetgrent_r (&host, &user, &domain, buf, sizeof (buf)))) {
while ((rc = getnetgrent (&host, &user, &domain))) {
if (hl == NULL)
hl = hostlist_create (host);
else
6 changes: 3 additions & 3 deletions src/pdsh/dsh.c
Original file line number Diff line number Diff line change
@@ -263,8 +263,8 @@ static void _fwd_signal(int signum)

dsh_mutex_lock(&thd_mutex);
for (i = 0; t[i].host != NULL; i++) {
if ((t[i].state == DSH_READING))
rcmd_signal(t[i].rcmd, signum);
if (t[i].state == DSH_READING)
rcmd_signal(t[i].rcmd, signum);
}
dsh_mutex_unlock(&thd_mutex);

@@ -647,7 +647,7 @@ static void *_rsh_thread(void *args)
if (a->rcmd->opts->resolve_hosts)
_gethost(a->host, a->addr);
#endif
_xsignal (SIGPIPE, SIG_BLOCK);
_xsignal (SIGPIPE, SIG_IGN);

/* establish the connection */
dsh_mutex_lock(&thd_mutex);
2 changes: 1 addition & 1 deletion src/pdsh/mod.c
Original file line number Diff line number Diff line change
@@ -342,7 +342,7 @@ static int _mod_initialize_modules_by_name (char *names, List m)
{
List l;

if (names == NULL)
if (names == NULL || strlen(names) == 0)
return (0);

l = list_split (",", names);
2 changes: 2 additions & 0 deletions src/pdsh/opt.c
Original file line number Diff line number Diff line change
@@ -501,7 +501,9 @@ void opt_args_early (opt_t * opt, int argc, char *argv[])
extern int optind;
extern char *optarg;
extern int opterr;
#ifdef __linux
int pc = 0;
#endif

/*
* Disable error reporting from getopt during early processing,
6 changes: 1 addition & 5 deletions src/pdsh/wcoll.h
Original file line number Diff line number Diff line change
@@ -33,13 +33,9 @@

#include <stdio.h> /* FILE * */

#include "src/common/macros.h"
#include "src/common/hostlist.h"

#ifndef _BOOL_DEFINED
#define _BOOL_DEFINED
typedef enum { false, true } bool;
#endif /* !_BOOL_DEFINED */

hostlist_t read_wcoll(char *, FILE *);

/*
27 changes: 19 additions & 8 deletions tests/t6036-long-output-lines.sh
Original file line number Diff line number Diff line change
@@ -6,15 +6,26 @@ Test that pdsh does not truncate very long lines'

. ${srcdir:-.}/test-lib.sh

test_expect_success 'pdsh does not truncate very long lines' '
dd if=/dev/urandom bs=1024 count=100 | base64 -w8000 > testfile &&
pdsh -w foo -N -Rexec cat testfile > output &&
test_cmp testfile output
'
test_expect_success 'pdsh does not truncate even longer lines' '
dd if=/dev/urandom bs=1024 count=100 | base64 -w80000 > testfile &&
if which base64 >/dev/null; then
base64="base64"
elif which openssl >/dev/null; then
base64="openssl base64"
else
skip_all 'failed to find base64 program'
fi


test_expect_success 'pdsh does not truncate very long lines' "
dd if=/dev/urandom bs=1024 count=100 | $base64 | tr -d '\n' | fold -w8000 > testfile &&
echo >>testfile &&
pdsh -w foo -N -Rexec cat testfile > output &&
test_cmp testfile output
'
"
test_expect_success 'pdsh does not truncate even longer lines' "
dd if=/dev/urandom bs=1024 count=100 | $base64 | tr -d '\n' | fold -w80000 > testfile2 &&
echo >>testfile2 &&
pdsh -w foo -N -Rexec cat testfile2 > output2 &&
test_cmp testfile2 output2
"

test_done