]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: --continue-at is mutually exclusive with --remove-on-error
authorDaniel Stenberg <daniel@haxx.se>
Mon, 2 Dec 2024 13:12:29 +0000 (14:12 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Dec 2024 20:22:57 +0000 (21:22 +0100)
Test 482 verifies

Fixes #15645
Reported-by: Harry Sintonen
Closes #15668

docs/cmdline-opts/continue-at.md
docs/cmdline-opts/remove-on-error.md
src/tool_getparam.c
tests/data/Makefile.am
tests/data/test482 [new file with mode: 0644]

index 607cf4c0fd457afd2a3168134877ed5dbdbf8eae..969068f2a38bde8bb946547934a6b18cb8133074 100644 (file)
@@ -28,4 +28,5 @@ transfer. It then uses the given output/input files to figure that out.
 This command line option is mutually exclusive with --range: you can only use
 one of them for a single transfer.
 
-The --no-clobber option cannot be used together with --continue-at.
+The --no-clobber and --remove-on-error options cannot be used together with
+--continue-at.
index 4f9cf90de1bf1d888849dd5fe964757e8733fcde..a88daf991675a9d2dd212f91da0258f9bd502924 100644 (file)
@@ -19,3 +19,5 @@ save output in a local file. This prevents curl from leaving a partial file in
 the case of an error during transfer.
 
 If the output is not a regular file, this option has no effect.
+
+The --continue-at option cannot be used together with --remove-on-error.
index c7da51ae1ad2eaf81b4e05833e694b33cd52a034..abae52bd960a31fac67700da4b0b6c26e52a7c7c 100644 (file)
@@ -1849,6 +1849,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         errorf(global, "--continue-at is mutually exclusive with --range");
         return PARAM_BAD_USE;
       }
+      if(config->rm_partial) {
+        errorf(config->global,
+               "--continue-at is mutually exclusive with --remove-on-error");
+        return PARAM_BAD_USE;
+      }
       if(config->file_clobber_mode == CLOBBER_NEVER) {
         errorf(config->global,
                "--continue-at is mutually exclusive with --no-clobber");
@@ -2162,6 +2167,11 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       }
       break;
     case C_REMOVE_ON_ERROR: /* --remove-on-error */
+      if(config->use_resume && toggle) {
+        errorf(config->global,
+               "--continue-at is mutually exclusive with --remove-on-error");
+        return PARAM_BAD_USE;
+      }
       config->rm_partial = toggle;
       break;
     case C_FAIL: /* --fail */
index d13811a4fa91f88d2f417921322e2d34d66f1a4e..776b5934bb99270ebb07acb8db618370f1fa9ac2 100644 (file)
@@ -77,7 +77,7 @@ test435 test436 test437 test438 test439 test440 test441 test442 test443 \
 test444 test445 test446 test447 test448 test449 test450 test451 test452 \
 test453 test454 test455 test456 test457 test458 test459 test460 test461 \
 test462 test463 test467 test468 test469 test470 test471 test472 test473 \
-test474 test475 test476 test477 test478 test479 test480 test481 \
+test474 test475 test476 test477 test478 test479 test480 test481 test482 \
 \
 test490 test491 test492 test493 test494 test495 test496 test497 test498 \
 test499 test500 test501 test502 test503 test504 test505 test506 test507 \
diff --git a/tests/data/test482 b/tests/data/test482
new file mode 100644 (file)
index 0000000..ce7f8f2
--- /dev/null
@@ -0,0 +1,41 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+--remove-on-error
+--continue-at
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+--remove-on-error with --continue-at
+</name>
+<command option="no-output,no-include">
+http://non-existing-host.haxx.se. --remove-on-error -C 1 -o "%LOGDIR/%TESTNUMBER"
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<errorcode>
+2
+</errorcode>
+<stderr mode="text">
+curl: --continue-at is mutually exclusive with --remove-on-error
+curl: option -C: is badly used here
+curl: try 'curl --help' or 'curl --manual' for more information
+</stderr>
+</verify>
+</testcase>