-
Notifications
You must be signed in to change notification settings - Fork 351
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
Add independent update mode for symbolic links #198
base: master
Are you sure you want to change the base?
Changes from all commits
2faa79d
2a73ee0
9193cf9
709498f
0b7c03c
b325f60
56d4970
93dce32
16bea89
ed3a831
c6eeba4
eae5c5f
d319418
467ef54
9b172df
7ba3169
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build & publish | ||
on: {push: {branches: [master]}, pull_request: {branches: [master]}, workflow_dispatch} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- id: debianise | ||
uses: twojstaryzdomu/debianise@HEAD | ||
with: | ||
create_changelog: true | ||
install_build_depends: false | ||
debug: true | ||
- id: action-gh-release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: ${{ steps.debianise.outputs.files }} | ||
name: ${{ steps.debianise.outputs.release_name }} | ||
tag_name: ${{ steps.debianise.outputs.tag_name }} | ||
fail_on_unmatched_files: true | ||
draft: true | ||
prerelease: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
11 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Source: rsync | ||
Section: unknown | ||
Priority: optional | ||
Maintainer: unknown <pi@> | ||
Build-Depends: debhelper (>= 11) | ||
Standards-Version: 4.1.3 | ||
Homepage: https://github.com/twojstaryzdomu/rsync | ||
Vcs-Git: https://github.com/twojstaryzdomu/rsync.git | ||
Vcs-Browser: https://github.com/twojstaryzdomu/rsync | ||
|
||
|
||
Package: rsync | ||
Section: unknown | ||
Architecture: any | ||
Depends: ${shlibs:Depends}, ${misc:Depends} | ||
Description: rsync description |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/Makefile.in b/Makefile.in | ||
index 3cde955..ef71d7e 100644 | ||
--- a/Makefile.in | ||
+++ b/Makefile.in | ||
@@ -210,15 +210,6 @@ configure.sh config.h.in: configure.ac aclocal.m4 | ||
else \ | ||
echo "config.h.in has CHANGED."; \ | ||
fi | ||
- @if test -f configure.sh.old || test -f config.h.in.old; then \ | ||
- if test "$(MAKECMDGOALS)" = reconfigure; then \ | ||
- echo 'Continuing with "make reconfigure".'; \ | ||
- else \ | ||
- echo 'You may need to run:'; \ | ||
- echo ' make reconfigure'; \ | ||
- exit 1; \ | ||
- fi \ | ||
- fi | ||
|
||
.PHONY: reconfigure | ||
reconfigure: configure.sh | ||
@@ -232,17 +223,6 @@ restatus: | ||
Makefile: Makefile.in config.status configure.sh config.h.in | ||
@if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi | ||
@./config.status | ||
- @if diff Makefile Makefile.old >/dev/null 2>&1; then \ | ||
- echo "Makefile is unchanged."; \ | ||
- rm Makefile.old; \ | ||
- else \ | ||
- if test "$(MAKECMDGOALS)" = reconfigure; then \ | ||
- echo 'Continuing with "make reconfigure".'; \ | ||
- else \ | ||
- echo "Makefile updated -- rerun your make command."; \ | ||
- exit 1; \ | ||
- fi \ | ||
- fi | ||
|
||
stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile | ||
sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
disable_reconfigure_req.diff |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/make -f | ||
%: | ||
dh $@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version=4 | ||
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/rsync-$1\.tar\.gz/ \ | ||
https://github.com/twojstaryzdomu/rsync/releases .*/v?(\d\S+)\.tar\.gz |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ extern int implied_dirs; | |
extern int ignore_perishable; | ||
extern int non_perishable_cnt; | ||
extern int prune_empty_dirs; | ||
extern int update_links; | ||
extern int copy_links; | ||
extern int copy_unsafe_links; | ||
extern int protocol_version; | ||
|
@@ -234,10 +235,15 @@ static int readlink_stat(const char *path, STRUCT_STAT *stp, char *linkbuf) | |
int link_stat(const char *path, STRUCT_STAT *stp, int follow_dirlinks) | ||
{ | ||
#ifdef SUPPORT_LINKS | ||
if (copy_links) | ||
if (copy_links && update_links == 0) | ||
return x_stat(path, stp, NULL); | ||
if (x_lstat(path, stp, NULL) < 0) | ||
return -1; | ||
if (update_links && S_ISLNK(stp->st_mode)) { | ||
STRUCT_STAT st; | ||
if (x_stat(path, &st, NULL) == 0 && !S_ISDIR(st.st_mode)) | ||
return 0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hunk baffles me. It does a stat of the referent file, and if it's a non-dir it re-stats the symlink's stat that is already present in stp and returns. But if it is not a dir, the following code also returns the same stat data that is already in stp. So, it seems like this can be dropped as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Precisely, if the symlink points at a non-directory referent, return the symlink's stat or fall through. It's only apparent looking at the surrounding code why the x_lstat call is redundant. Committed as |
||
if (follow_dirlinks && S_ISLNK(stp->st_mode)) { | ||
STRUCT_STAT st; | ||
if (x_stat(path, &st, NULL) == 0 && S_ISDIR(st.st_mode)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they asked for --copy-links they should get --copy-links. Remember that it's only the sending side that sees this flag set, not the receiving side, so combining --copy-links with --update-links would mean that the sender doesn't send any symlinks, and the receiver could deal with any existing symlinks in the destination using the new option. (Thus, drop this change.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two modes appear mutually exclusive from a user standpoint. Either every symlink is transformed into referent (
--copy-links
) or copied across if newer (--update-links
).From testing the PR'd code briefly now, when both modes are enabled,
--update-links
trumps--copy-links
, by virtue of a subsequent condition atif (update_links && S_ISLNK(stp->st_mode))
.Added #274 to discuss how to handle symlink mode precedence.