Skip to content

Commit a56a8dd

Browse files
committed
Fix zsync parameter order
1 parent b340e54 commit a56a8dd

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

ci/install-static-zsyncmake.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,55 @@ wget \
3535
https://sources.debian.org/data/main/z/zsync/0.6.2-6/debian/patches/manpages.diff \
3636
https://sources.debian.org/data/main/z/zsync/0.6.2-6/debian/patches/clienthttp.diff \
3737
https://sources.debian.org/data/main/z/zsync/0.6.2-6/debian/patches/fix-build-with-gcc-14.patch
38+
3839
sha256sum -c <<\EOF
3940
f14a7ffcb3bdadba252c9afbe5e8da358fc77f20072ae5b21475bdfc44b50975 buildsystem.diff
4041
085e9b5856bb8ac0d8567e977a9d5fafc6c19df02b7cfb8e011fedaf2862eaad clienthttp.diff
4142
f04bba2866c47b8597723d49eec3f1fd50e40a08171e261bf0fc262852ba17e5 manpages.diff
4243
35cbce69194743df1f3f4b9bc9ad36a4c440b117c6a17c268023c642c0d50650 fix-build-with-gcc-14.patch
4344
EOF
4445

46+
# custom patch to at least ignore flags passed after the first parameter
47+
# see https://github.com/AppImage/appimagetool/pull/93 for more information
48+
cat > argparser.patch <<\EOF
49+
diff --git a/make.c b/make.c
50+
index 191b527..d86f130 100644
51+
--- a/make.c
52+
+++ b/make.c
53+
@@ -564,6 +564,14 @@ off_t get_len(FILE * f) {
54+
* Main program
55+
*/
56+
int main(int argc, char **argv) {
57+
+ if (getenv("VERBOSE") != 0) {
58+
+ fprintf(stderr, "Parameters:");
59+
+ for (int i = 0; i < argc; ++i) {
60+
+ fprintf(stderr, " %s", argv[i]);
61+
+ }
62+
+ fprintf(stderr, "\n\n");
63+
+ }
64+
+
65+
FILE *instream;
66+
char *fname = NULL, *zfname = NULL;
67+
char **url = NULL;
68+
@@ -641,7 +649,7 @@ int main(int argc, char **argv) {
69+
}
70+
71+
/* Open data to create .zsync for - either it's a supplied filename, or stdin */
72+
- if (optind == argc - 1) {
73+
+ if (optind <= argc - 1) {
74+
infname = strdup(argv[optind]);
75+
instream = fopen(infname, "rb");
76+
if (!instream) {
77+
EOF
78+
4579
for i in *.diff *.patch; do
4680
echo "Applying patch $i..."
4781
patch -p1 < "$i"
4882
done
4983

5084
find . -type f -exec sed -i -e 's|off_t|size_t|g' {} \;
5185

52-
./configure CFLAGS=-no-pie LDFLAGS=-static --prefix=/usr --build=$(arch)-unknown-linux-gnu
86+
./configure LDFLAGS=-static --prefix=/usr --build=$(arch)-unknown-linux-gnu
5387

5488
if [[ "${GITHUB_ACTIONS:-}" != "" ]]; then
5589
jobs="$(nproc)"

src/appimagetool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,8 @@ main (int argc, char *argv[])
11291129
fprintf(stderr, "zsyncmake is available and updateinformation is provided, "
11301130
"hence generating zsync file\n");
11311131

1132-
const gchar* const zsyncmake_command[] = {zsyncmake_path, destination, "-u", basename(destination), NULL};
1132+
// notice for Alpine builds: Alpine's getopt does not parse flags passed after the first parameter, order matters here
1133+
const gchar* const zsyncmake_command[] = {zsyncmake_path, "-u", basename(destination), destination, NULL};
11331134

11341135
if (verbose) {
11351136
fprintf(stderr, "Running zsyncmake process: ");

0 commit comments

Comments
 (0)