Message ID | 20240807140220.3445203-1-adolf.belka@ipfire.org |
---|---|
State | Staged |
Commit | 5b2ee7520f9a9296898a226b6dc776d0114102bd |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4WfBh4681dz3x2s for <patchwork@web04.haj.ipfire.org>; Wed, 7 Aug 2024 14:02:28 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4WfBh20z6TzbV; Wed, 7 Aug 2024 14:02:26 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4WfBh16ZmQz33yq; Wed, 7 Aug 2024 14:02:25 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4WfBgz1fvJz30Gj for <development@lists.ipfire.org>; Wed, 7 Aug 2024 14:02:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4WfBgy43RPz31; Wed, 7 Aug 2024 14:02:22 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1723039342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=yArt1wl7KvqWj/mvV4YyONO+v7AcXQc1UqemZU79s/s=; b=E+BFBx0wJLjDKT+ZyU39iJw7DQK2sktIxG1t/e7HNeULxP6F22q+SD4kBYN/gQWrM5F3FH MZbIHbGHknUtJABw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1723039342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=yArt1wl7KvqWj/mvV4YyONO+v7AcXQc1UqemZU79s/s=; b=sLl9WuaRKKlVsrug/9N2Z4/tgFjmD259b1uVQFE+5SR3UUDfZ/+Wpnf/GJT+1poHkr6t3P PkcEnU/3gO6pUtEsBsKaKkMY9sWs6r1OYUmGqvcbkB8l6940ppN305+gLYIz+L7zyXgSmC uZCONfOHIAHIo6oAOtfys5VFpLV8behHDXOrsDnWQs+YPriuhhX5urbgNeIW0dcPEqq6tf VICQ3JMehIvwOzHSO6dwxXGoQias9t1WUBEoIC/V25YuLW1ezBrXyrxS/56gypX+HqWevk /1lc3ubS29/4F+TZuvxXYUy4dOgcKVUMU5PZSpALc8tt16Ts8lOUvE7k/c/J4g== From: Adolf Belka <adolf.belka@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH] backup.pl: Fixes bug13734 - tar treats colon in filename as remote location Date: Wed, 7 Aug 2024 16:02:20 +0200 Message-ID: <20240807140220.3445203-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: A3BQA5MEV26IPW4ZXJ34Z37TCBWMFKQJ X-Message-ID-Hash: A3BQA5MEV26IPW4ZXJ34Z37TCBWMFKQJ X-MailFrom: adolf.belka@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> Archived-At: <https://lists.ipfire.org/hyperkitty/list/development@lists.ipfire.org/message/A3BQA5MEV26IPW4ZXJ34Z37TCBWMFKQJ/> List-Archive: <https://lists.ipfire.org/hyperkitty/list/development@lists.ipfire.org/> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Owner: <mailto:development-owner@lists.ipfire.org> List-Post: <mailto:development@lists.ipfire.org> List-Subscribe: <mailto:development-join@lists.ipfire.org> List-Unsubscribe: <mailto:development-leave@lists.ipfire.org> |
Series |
backup.pl: Fixes bug13734 - tar treats colon in filename as remote location
|
|
Commit Message
Adolf Belka
Aug. 7, 2024, 2:02 p.m. UTC
- When a user tries to restore on the console from a backup on IPFire that has a colon in the filename the tar treats this as meaning that everything after the colon is information about a remote location to do the extraction to. This results in a filename that cannot be found, and a remote location that is not correct and the tar operation fails. - This has been confirmed by myself. - If the user tries a restore from a file downloaded to another computer then for most, if not all browsers, the colon will have been replaced by an underscore or other character. Firefox, Chromium and Vivaldi do this. - So any backup file that is selected to be restored using the WUI will no longer have a colon in the filename. - This patch adds --force-local to the tar command, which means that tar will treat the colon as a character in the filename. This will ensure that if a user has any backup files stored on their IPFire system, with a colon in the filename then doing a restore from this file will not cause tar to fail. - The NOW variable is also changed to replace the colon by a dash and to separate the date and time by an underscore. This filename will be accepted by browsers, without doing any replacements. Tested out with Firefox, Chromium & Vivaldi. - The above ensures that both the new and old filename versions will work for doing a restore. Fixes: bug13734 Tested-by: Adolf Belka <adolf.belka@ipfire.org> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> --- config/backup/backup.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Comments
Adolf, Suggested change for "NOW": I believe users will find it is easier to read a date like 2024-08-07_10.57 (with a period separator for time) vs. 2024-08-07_10-58. It is a small change but a helpful one for readability. Jon > On Aug 7, 2024, at 9:02 AM, Adolf Belka <adolf.belka@ipfire.org> wrote: > > - When a user tries to restore on the console from a backup on IPFire that has a colon in > the filename the tar treats this as meaning that everything after the colon is > information about a remote location to do the extraction to. This results in a filename > that cannot be found, and a remote location that is not correct and the tar operation > fails. > - This has been confirmed by myself. > - If the user tries a restore from a file downloaded to another computer then for most, if > not all browsers, the colon will have been replaced by an underscore or other character. > Firefox, Chromium and Vivaldi do this. > - So any backup file that is selected to be restored using the WUI will no longer have a > colon in the filename. > - This patch adds --force-local to the tar command, which means that tar will treat the > colon as a character in the filename. This will ensure that if a user has any backup > files stored on their IPFire system, with a colon in the filename then doing a restore > from this file will not cause tar to fail. > - The NOW variable is also changed to replace the colon by a dash and to separate the date > and time by an underscore. This filename will be accepted by browsers, without doing > any replacements. Tested out with Firefox, Chromium & Vivaldi. > - The above ensures that both the new and old filename versions will work for doing a > restore. > > Fixes: bug13734 > Tested-by: Adolf Belka <adolf.belka@ipfire.org> > Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> > --- > config/backup/backup.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/config/backup/backup.pl b/config/backup/backup.pl > index d848084e9..7b2f95304 100644 > --- a/config/backup/backup.pl > +++ b/config/backup/backup.pl > @@ -2,7 +2,7 @@ > ############################################################################### > # # > # IPFire.org - A linux based firewall # > -# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # > +# Copyright (C) 2007-2024 IPFire Team <info@ipfire.org> # > # # > # This program is free software: you can redistribute it and/or modify # > # it under the terms of the GNU General Public License as published by # > @@ -21,7 +21,7 @@ > > shopt -s nullglob > > -NOW="$(date "+%Y-%m-%d-%H:%M")" > +NOW="$(date "+%Y-%m-%d_%H-%M")" > > list_addons() { > local file > @@ -82,7 +82,8 @@ restore_backup() { > # Extract backup > if ! tar xvzpf "${filename}" -C / \ > --exclude-from="/var/ipfire/backup/exclude" \ > - --exclude-from="/var/ipfire/backup/exclude.user"; then > + --exclude-from="/var/ipfire/backup/exclude.user" \ > + --force-local; then > echo "Could not extract backup" >&2 > return 1 > fi > -- > 2.45.2 > Jon Murphy jon.murphy@ipfire.org
Hi Jon, On 07/08/2024 18:05, jon wrote: > Adolf, > > Suggested change for "NOW": I believe users will find it is easier to read a date like 2024-08-07_10.57 (with a period separator for time) vs. 2024-08-07_10-58. The change I put in was what was proposed by the user that reported the bug. Maybe you could flag up your suggestion in the bug report to the originator to see what their feedback is. Regards, Adolf. > It is a small change but a helpful one for readability. > > > > Jon > > >> On Aug 7, 2024, at 9:02 AM, Adolf Belka <adolf.belka@ipfire.org> wrote: >> >> - When a user tries to restore on the console from a backup on IPFire that has a colon in >> the filename the tar treats this as meaning that everything after the colon is >> information about a remote location to do the extraction to. This results in a filename >> that cannot be found, and a remote location that is not correct and the tar operation >> fails. >> - This has been confirmed by myself. >> - If the user tries a restore from a file downloaded to another computer then for most, if >> not all browsers, the colon will have been replaced by an underscore or other character. >> Firefox, Chromium and Vivaldi do this. >> - So any backup file that is selected to be restored using the WUI will no longer have a >> colon in the filename. >> - This patch adds --force-local to the tar command, which means that tar will treat the >> colon as a character in the filename. This will ensure that if a user has any backup >> files stored on their IPFire system, with a colon in the filename then doing a restore >> from this file will not cause tar to fail. >> - The NOW variable is also changed to replace the colon by a dash and to separate the date >> and time by an underscore. This filename will be accepted by browsers, without doing >> any replacements. Tested out with Firefox, Chromium & Vivaldi. >> - The above ensures that both the new and old filename versions will work for doing a >> restore. >> >> Fixes: bug13734 >> Tested-by: Adolf Belka <adolf.belka@ipfire.org> >> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> >> --- >> config/backup/backup.pl | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/config/backup/backup.pl b/config/backup/backup.pl >> index d848084e9..7b2f95304 100644 >> --- a/config/backup/backup.pl >> +++ b/config/backup/backup.pl >> @@ -2,7 +2,7 @@ >> ############################################################################### >> # # >> # IPFire.org - A linux based firewall # >> -# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # >> +# Copyright (C) 2007-2024 IPFire Team <info@ipfire.org> # >> # # >> # This program is free software: you can redistribute it and/or modify # >> # it under the terms of the GNU General Public License as published by # >> @@ -21,7 +21,7 @@ >> >> shopt -s nullglob >> >> -NOW="$(date "+%Y-%m-%d-%H:%M")" >> +NOW="$(date "+%Y-%m-%d_%H-%M")" >> >> list_addons() { >> local file >> @@ -82,7 +82,8 @@ restore_backup() { >> # Extract backup >> if ! tar xvzpf "${filename}" -C / \ >> --exclude-from="/var/ipfire/backup/exclude" \ >> - --exclude-from="/var/ipfire/backup/exclude.user"; then >> + --exclude-from="/var/ipfire/backup/exclude.user" \ >> + --force-local; then >> echo "Could not extract backup" >&2 >> return 1 >> fi >> -- >> 2.45.2 >> > > > > Jon Murphy > jon.murphy@ipfire.org > > >
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org> Am 07.08.2024 um 16:02 schrieb Adolf Belka: > - When a user tries to restore on the console from a backup on IPFire that has a colon in > the filename the tar treats this as meaning that everything after the colon is > information about a remote location to do the extraction to. This results in a filename > that cannot be found, and a remote location that is not correct and the tar operation > fails. > - This has been confirmed by myself. > - If the user tries a restore from a file downloaded to another computer then for most, if > not all browsers, the colon will have been replaced by an underscore or other character. > Firefox, Chromium and Vivaldi do this. > - So any backup file that is selected to be restored using the WUI will no longer have a > colon in the filename. > - This patch adds --force-local to the tar command, which means that tar will treat the > colon as a character in the filename. This will ensure that if a user has any backup > files stored on their IPFire system, with a colon in the filename then doing a restore > from this file will not cause tar to fail. > - The NOW variable is also changed to replace the colon by a dash and to separate the date > and time by an underscore. This filename will be accepted by browsers, without doing > any replacements. Tested out with Firefox, Chromium & Vivaldi. > - The above ensures that both the new and old filename versions will work for doing a > restore. > > Fixes: bug13734 > Tested-by: Adolf Belka <adolf.belka@ipfire.org> > Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> > --- > config/backup/backup.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/config/backup/backup.pl b/config/backup/backup.pl > index d848084e9..7b2f95304 100644 > --- a/config/backup/backup.pl > +++ b/config/backup/backup.pl > @@ -2,7 +2,7 @@ > ############################################################################### > # # > # IPFire.org - A linux based firewall # > -# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # > +# Copyright (C) 2007-2024 IPFire Team <info@ipfire.org> # > # # > # This program is free software: you can redistribute it and/or modify # > # it under the terms of the GNU General Public License as published by # > @@ -21,7 +21,7 @@ > > shopt -s nullglob > > -NOW="$(date "+%Y-%m-%d-%H:%M")" > +NOW="$(date "+%Y-%m-%d_%H-%M")" > > list_addons() { > local file > @@ -82,7 +82,8 @@ restore_backup() { > # Extract backup > if ! tar xvzpf "${filename}" -C / \ > --exclude-from="/var/ipfire/backup/exclude" \ > - --exclude-from="/var/ipfire/backup/exclude.user"; then > + --exclude-from="/var/ipfire/backup/exclude.user" \ > + --force-local; then > echo "Could not extract backup" >&2 > return 1 > fi
diff --git a/config/backup/backup.pl b/config/backup/backup.pl index d848084e9..7b2f95304 100644 --- a/config/backup/backup.pl +++ b/config/backup/backup.pl @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # +# Copyright (C) 2007-2024 IPFire Team <info@ipfire.org> # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -21,7 +21,7 @@ shopt -s nullglob -NOW="$(date "+%Y-%m-%d-%H:%M")" +NOW="$(date "+%Y-%m-%d_%H-%M")" list_addons() { local file @@ -82,7 +82,8 @@ restore_backup() { # Extract backup if ! tar xvzpf "${filename}" -C / \ --exclude-from="/var/ipfire/backup/exclude" \ - --exclude-from="/var/ipfire/backup/exclude.user"; then + --exclude-from="/var/ipfire/backup/exclude.user" \ + --force-local; then echo "Could not extract backup" >&2 return 1 fi