Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/scripts/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ def script(selected, name):
enable(selected, 'linux', 'diagnostics')
elif name == 'install-cygwin.ps1':
enable(selected, 'other', 'diagnostics')
elif name == 'prepare-vm-host.sh':
elif name == 'prepare-macos.sh':
enable(selected, 'macos', 'interoperability', 'diagnostics')
elif name == 'prepare-manpages.sh':
enable(selected, 'linux', 'macos', 'diagnostics')
elif name == 'unpack-android-artifact.sh':
enable(selected, 'android', 'diagnostics')
elif name in ('prepare-vm-host.sh', 'vm-ssh.sh'):
enable(selected, 'bsd', 'other', 'diagnostics', 'interoperability')
elif name == 'ubuntu-apt.sh':
enable(selected, 'linux', 'bsd', 'other', 'android', 'archive', 'diagnostics', 'versions',
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/install-cygwin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ if (-not (Test-Path -LiteralPath $bash)) { throw 'Cygwin setup did not install b
& $bash -lc 'command -v make aclocal gcc /usr/bin/git python3 >/dev/null'
if ($LASTEXITCODE -ne 0) { throw 'Cygwin setup did not install all required build tools' }
'C:/tools/cygwin/bin' >>$Env:GITHUB_PATH
# The version wrapper cannot infer an Autoconf version from rsync's handwritten configure script.
'WANT_AUTOCONF=latest' >>$Env:GITHUB_ENV
12 changes: 12 additions & 0 deletions .github/scripts/prepare-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -eu

set --
for formula in automake openssl xxhash zstd lz4 libidn2; do
if ! brew --prefix --installed "$formula" >/dev/null; then
set -- "$@" "$formula"
fi
done
if [ "$#" -gt 0 ]; then
brew install "$@"
fi
9 changes: 9 additions & 0 deletions .github/scripts/prepare-manpages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -eu

venv="${RUNNER_TEMP:?}/rsync-manpages"
python3 -m venv "$venv"
PATH="$venv/bin:$PATH"
export PATH
"$venv/bin/python3" -m pip install --no-cache-dir 'commonmark==0.9.2'
printf '%s\n' "$venv/bin" >>"${GITHUB_PATH:?}"
16 changes: 10 additions & 6 deletions .github/scripts/prepare-vm-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ esac

if [ "$mode" = update-first ]; then
sh .github/scripts/ubuntu-apt.sh update
exec sh .github/scripts/ubuntu-apt.sh install -y "$@"
sh .github/scripts/ubuntu-apt.sh install -y "$@"
elif ! sh .github/scripts/ubuntu-apt.sh install -y -q -o Acquire::Retries=3 --no-install-recommends "$@"; then
sh .github/scripts/ubuntu-apt.sh update -q
sh .github/scripts/ubuntu-apt.sh install -y -q -o Acquire::Retries=3 --no-install-recommends "$@"
fi

if sh .github/scripts/ubuntu-apt.sh install -y -q -o Acquire::Retries=3 --no-install-recommends "$@"; then
exit 0
fi
sh .github/scripts/ubuntu-apt.sh update -q
exec sh .github/scripts/ubuntu-apt.sh install -y -q -o Acquire::Retries=3 --no-install-recommends "$@"
real_ssh=$(command -v ssh)
bin="${RUNNER_TEMP:?}/rsync-vm-bin"
mkdir "$bin"
install -m 0755 .github/scripts/vm-ssh.sh "$bin/ssh"
printf 'RSYNC_VM_SSH=%s\n' "$real_ssh" >>"${GITHUB_ENV:?}"
printf '%s\n' "$bin" >>"${GITHUB_PATH:?}"
4 changes: 4 additions & 0 deletions .github/scripts/test-changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def test_ci_files_select_their_owner(self):
'.github/scripts/changes.py': full_selection,
'.github/scripts/test-changes.py': {'diagnostics'},
'.github/scripts/check-platform.py': {'linux', 'macos', 'other', 'diagnostics'},
'.github/scripts/prepare-macos.sh': {'macos', 'interoperability', 'diagnostics'},
'.github/scripts/prepare-manpages.sh': {'linux', 'macos', 'diagnostics'},
'.github/scripts/prepare-vm-host.sh': {'bsd', 'other', 'diagnostics', 'interoperability'},
'.github/scripts/unpack-android-artifact.sh': {'android', 'diagnostics'},
'.github/scripts/vm-ssh.sh': {'bsd', 'other', 'diagnostics', 'interoperability'},
'.github/scripts/ubuntu-apt.sh': full_selection - {'macos'},
'.github/actions/interoperability/action.yml': {'interoperability', 'diagnostics'},
'.github/actions/interop-upload/action.yml': {'interoperability', 'diagnostics'},
Expand Down
43 changes: 43 additions & 0 deletions .github/scripts/unpack-android-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
set -eu

if [ "$#" -ne 1 ]; then
echo 'usage: unpack-android-artifact.sh <artifact-directory>' >&2
exit 2
fi
case "$1" in
/*) ;;
*) echo 'Expected an absolute artifact directory' >&2; exit 2 ;;
esac

set -- "$1"/*
if [ "$#" -ne 1 ] || [ ! -f "$1" ] || [ -L "$1" ]; then
echo 'Expected exactly one downloaded Android archive' >&2
exit 1
fi
archive=$1
members=$(LC_ALL=C unzip -Z -1 "$archive")
binary=$(printf '%s\n' "$members" | LC_ALL=C awk '
/^rsync-[A-Za-z0-9.+-]+-android-x86_64$/ { binary = $0; next }
/^rsync-[A-Za-z0-9.+-]+-android-x86_64[.]sha256$/ { checksum = $0; next }
END {
if (NR != 2 || !binary || checksum != binary ".sha256")
exit 1
print binary
}
') || {
echo 'Expected one x86-64 Android binary and its checksum in the archive' >&2
exit 1
}

# Stream the expected members into a new directory without extracting archive paths.
umask 077
mkdir dist
(
ulimit -f 131072
unzip -p "$archive" "$binary" >"dist/$binary"
)
(
ulimit -f 2
unzip -p "$archive" "$binary.sha256" >"dist/$binary.sha256"
)
35 changes: 35 additions & 0 deletions .github/scripts/vm-ssh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -u

# OpenSSH writes host-key acceptance at info level and prefixes it with "Warning:".
# Normalise only that message for loopback VM connections.
: "${RSYNC_VM_SSH:?}"
command -v sed >/dev/null || exit 127
coproc FILTER {
LC_ALL=C sed -u -E "s/^Warning: Permanently added '(\[127\.0\.0\.1\]:[0-9]+)' \(([A-Za-z0-9_-]+)\) to the list of known hosts\.$/VM SSH accepted the host key for \1 (\2)./" >&2
}
filter_pid=$!
coproc_fd=${FILTER[1]}
exec {stderr_fd}>&"$coproc_fd"
"$RSYNC_VM_SSH" "$@" 2>&"$stderr_fd" &
ssh_pid=$!
exec {coproc_fd}>&-
exec {stderr_fd}>&-

trap '
trap - INT TERM HUP
kill -TERM "$ssh_pid" 2>/dev/null || :
wait "$ssh_pid" 2>/dev/null || :
wait "$filter_pid" 2>/dev/null || :
exit 143
' INT TERM HUP

wait "$ssh_pid"
ssh_status=$?
wait "$filter_pid"
filter_status=$?
trap - INT TERM HUP
if (( ssh_status != 0 )); then
exit "$ssh_status"
fi
exit "$filter_status"
7 changes: 5 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ jobs:
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: rsync-android-x86_64
path: dist/
path: ${{ runner.temp }}/rsync-android-artifact
skip-decompress: true
- &restore
name: Verify binary
run: python3 -S .github/scripts/android.py restore --abi x86_64
run: |
sh .github/scripts/unpack-android-artifact.sh "$RUNNER_TEMP/rsync-android-artifact" &&
python3 -S .github/scripts/android.py restore --abi x86_64
- name: Tests
id: test
run: python3 -S .github/scripts/android-emulator.py --termux --output test-results/termux
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/diagnostics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,21 @@ jobs:
sh .github/scripts/ubuntu-apt.sh "$@" update
sh .github/scripts/ubuntu-apt.sh "$@" install -y --no-install-recommends \
"clang-$LLVM_MAJOR" "clang-tools-$LLVM_MAJOR" cppcheck acl libacl1-dev attr libattr1-dev \
liblz4-dev libidn2-dev libzstd-dev libxxhash-dev libpopt-dev libssl-dev openssl
liblz4-dev libidn2-dev libzstd-dev libxxhash-dev libssl-dev openssl
- name: Tool versions
run: |
"clang-$LLVM_MAJOR" --version
cppcheck --version
- name: Configure
run: |
"scan-build-$LLVM_MAJOR" --use-cc="clang-$LLVM_MAJOR" --use-c++="clang++-$LLVM_MAJOR" \
./configure --with-rrsync --disable-md2man
./configure --with-rrsync --disable-md2man --with-included-popt
- name: Bundled popt hash
run: |
cc -std=c11 -O1 -g -Wall -Wextra -Werror \
-fsanitize=address,undefined -fno-omit-frame-pointer \
-o "$RUNNER_TEMP/t_popt_hash" t_popt_hash.c
"$RUNNER_TEMP/t_popt_hash"
- name: Clang static analyser
run: python3 -B -S .github/scripts/diagnostics.py scan "$LLVM_MAJOR"
- name: Cppcheck
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/interoperability-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:
cache: false
- name: Install dependencies
run: |
brew install automake openssl xxhash zstd lz4 libidn2
sh .github/scripts/prepare-macos.sh
echo "$(brew --prefix openssl)/bin" >>"$GITHUB_PATH"
- name: Configure
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
xxhash xxhash-devel \
libidn2 libidn2-devel
alternatives --set python3 /usr/bin/python3.9
pip3 install commonmark
sh .github/scripts/prepare-manpages.sh
- name: Platform
run: python3 -S .github/scripts/check-platform.py almalinux --release 8 --arch x86_64
- name: Configure
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
run: python3 -S .github/scripts/check-platform.py macos --release "${{ matrix.release }}" --arch "${{ matrix.arch }}"
- name: Install dependencies
run: |
brew install automake openssl xxhash zstd lz4 libidn2
pip3 install --user --break-system-packages commonmark
sh .github/scripts/prepare-macos.sh
echo "$(brew --prefix)/bin" >>"$GITHUB_PATH"
sh .github/scripts/prepare-manpages.sh
mkdir -p test-results
- name: Configure
run: |
Expand Down
26 changes: 13 additions & 13 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -212,23 +212,23 @@ help-rsync.h help-rsyncd.h: rsync.1.md help-from-md.awk
daemon-parm.h: daemon-parm.txt daemon-parm.awk
$(AWK) -f $(srcdir)/daemon-parm.awk $(srcdir)/daemon-parm.txt

rounding.h: rounding.c rsync.h proto.h
@for r in 0 1 3; do \
if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
rounding.h: rounding.c $(HEADERS)
@set -e; \
trap 'rm -f rounding.o rounding.out "$@.tmp"' 0; \
for r in 0 1 3; do \
if $(CC) $(CFLAGS) $(CPPFLAGS) -c -o rounding.o -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
cat rounding.out >&2; \
printf '#define EXTRA_ROUNDING %s\n' "$$r" >"$@.tmp"; \
mv -f "$@.tmp" "$@"; \
if test -f "$$HOME/build_farm/build_test.fns"; then \
echo "EXTRA_ROUNDING is $$r" >&2; \
fi; \
break; \
exit 0; \
fi; \
done
@rm -f rounding
@if test -f rounding.h; then : ; else \
cat rounding.out 1>&2; \
echo "Failed to create rounding.h!" 1>&2; \
exit 1; \
fi
@rm -f rounding.out
done; \
cat rounding.out >&2; \
echo "Failed to create $@!" >&2; \
exit 1

git-version.h: ALWAYS_RUN
$(srcdir)/mkgitver
Expand Down
4 changes: 2 additions & 2 deletions access.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@ enum unix_access { UNIX_ACCESS_NONE, UNIX_ACCESS_MODULE, UNIX_ACCESS_PROXY };
static int access_match(const char *list, const char *addr, const char **host_ptr,
int deny, enum unix_access unix_access)
{
char *tok;
char *tok, *save = NULL;
char *list2 = strdup(list);

strlower(list2);

for (tok = strtok(list2, " ,\t"); tok; tok = strtok(NULL, " ,\t")) {
for (tok = strtok_r(list2, " ,\t", &save); tok; tok = strtok_r(NULL, " ,\t", &save)) {
int match;
if (strcmp(tok, "unix:") == 0)
match = unix_access != UNIX_ACCESS_NONE;
Expand Down
6 changes: 4 additions & 2 deletions authenticate.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ static const char *check_secret(int module, const char *user, const char *group,
/* Try to find a line that starts with the user (or @group) name and a ':'. */
err = "secret not found";
while ((user || group) && fgets(line, sizeof line, fh) != NULL) {
const char **ptr, *s = strtok(line, "\n\r");
char *save = NULL;
const char **ptr, *s = strtok_r(line, "\n\r", &save);
int len;
if (!s)
continue;
Expand Down Expand Up @@ -361,6 +362,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
int group_match = -1;
char *tok, *pass;
char opt_ch = '\0';
struct conf_token_state tokens = {0};

if (use_pam) {
#ifndef SUPPORT_PAM
Expand Down Expand Up @@ -428,7 +430,7 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
* on whitespace here tore such an entry apart, so the rule the admin wrote
* never matched and a rule they never wrote appeared from its tail. The
* daemon's gid field already uses this parser (clientserver.c). */
for (tok = conf_strtok(users); tok; tok = conf_strtok(NULL)) {
for (tok = conf_strtok(users, &tokens); tok; tok = conf_strtok(NULL, &tokens)) {
char *opts;
/* See if the user appended :deny, :ro, or :rw. */
if ((opts = strchr(tok, ':')) != NULL) {
Expand Down
5 changes: 3 additions & 2 deletions clientserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
int save_munge_symlinks;
pid_t pre_exec_pid = 0;
char *request = NULL;
struct conf_token_state gid_tokens = {0};

set_env_str("RSYNC_MODULE_NAME", name);

Expand Down Expand Up @@ -880,7 +881,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
} else
set_uid = 0;

p = *lp_gid(module_id) ? conf_strtok(lp_gid(module_id)) : NULL;
p = *lp_gid(module_id) ? conf_strtok(lp_gid(module_id), &gid_tokens) : NULL;
if (p) {
/* The "*" gid must be the first item in the list. */
if (strcmp(p, "*") == 0) {
Expand All @@ -897,7 +898,7 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
#endif
} else if (add_a_group(f_out, p) < 0)
return -1;
while ((p = conf_strtok(NULL)) != NULL) {
while ((p = conf_strtok(NULL, &gid_tokens)) != NULL) {
#if defined HAVE_INITGROUPS && !defined HAVE_GETGROUPLIST
if (pw) {
rprintf(FLOG, "This rsync cannot add groups after \"*\".\n");
Expand Down
11 changes: 0 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1920,17 +1920,6 @@ if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
esac
fi

if test x"$enable_acl_support" = x"no" || test x"$enable_xattr_support" = x"no" || test x"$enable_iconv" = x"no"; then
AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-unused-parameter"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("hello\n");]])],[rsync_warn_flag=yes],[rsync_warn_flag=no])
AC_MSG_RESULT([$rsync_warn_flag])
if test x"$rsync_warn_flag" = x"no"; then
CFLAGS="$OLD_CFLAGS"
fi
fi

case "$CC" in
' checker'*|checker*)
AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
Expand Down
4 changes: 4 additions & 0 deletions flist.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ struct sender_source_root {
};

static struct sender_source_root *sender_source_roots;
#if defined AT_FDCWD && defined O_NOFOLLOW && defined O_DIRECTORY
static struct sender_source_root *sender_source_root_fd_owner;
static int sender_source_root_fd = -1;
#endif

static int sender_source_full_path(const char *path, char *full, size_t full_size)
{
Expand Down Expand Up @@ -402,12 +404,14 @@ int open_sender_source_path(const char *path, int flags, int *matched)

void clear_sender_source_roots(void)
{
#if defined AT_FDCWD && defined O_NOFOLLOW && defined O_DIRECTORY
if (sender_source_root_fd >= 0) {
reset_dir_fd_cache();
close(sender_source_root_fd);
}
sender_source_root_fd = -1;
sender_source_root_fd_owner = NULL;
#endif
while (sender_source_roots) {
struct sender_source_root *root = sender_source_roots;
sender_source_roots = root->next;
Expand Down
4 changes: 2 additions & 2 deletions generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ static BOOL destination_link_is_newer(const STRUCT_STAT *dest, const struct file
}
#ifdef ST_MTIME_NSEC
if (dest->st_mtime == source->modtime && modify_window < 0 && protocol_version >= 31)
return dest->ST_MTIME_NSEC > F_MOD_NSEC_or_0(source);
return dest->ST_MTIME_NSEC > (int64)F_MOD_NSEC_or_0(source);
#endif
return False;
}
Expand Down Expand Up @@ -575,7 +575,7 @@ int unchanged_attrs(const char *fname, struct file_struct *file, stat_x *sxp)
return 1;
}

void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statret,
void itemize(UNUSED(const char *fnamecmp), struct file_struct *file, int ndx, int statret,
stat_x *sxp, int32 iflags, uchar fnamecmp_type,
const char *xname)
{
Expand Down
Loading
Loading