public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v4 storage 4/4] status: fix tmpfile cleanup
Date: Tue, 31 Aug 2021 12:16:32 +0200	[thread overview]
Message-ID: <20210831101637.3080902-6-l.stechauner@proxmox.com> (raw)
In-Reply-To: <20210831101637.3080902-1-l.stechauner@proxmox.com>

$tmpfilename already gets unlinked after executing the cmd.

furthermore, because this is a local file, it is wrong to delete
it via the ssh command on a remote node.

small change: added \n to the error message.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
 PVE/API2/Storage/Status.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm
index 41b3696..5913281 100644
--- a/PVE/API2/Storage/Status.pm
+++ b/PVE/API2/Storage/Status.pm
@@ -459,7 +459,7 @@ __PACKAGE__->register_method ({
 	# best effort to match apl_download behaviour
 	chmod 0644, $tmpfilename;
 
-	my $err_cleanup = sub { unlink $dest, $tmpfilename; die "cleanup failed: $!" if $! && $! != ENOENT };
+	my $err_cleanup = sub { unlink $dest; die "cleanup failed: $!\n" if $! && $! != ENOENT };
 
 	my $cmd;
 	if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) {
@@ -481,7 +481,7 @@ __PACKAGE__->register_method ({
  
 	    $cmd = ['/usr/bin/scp', @ssh_options, '-p', '--', $tmpfilename, "[$remip]:" . PVE::Tools::shell_quote($dest)];
 
-	    $err_cleanup = sub { run_command([@remcmd, 'rm', '-f', '--', $dest, $tmpfilename]) };
+	    $err_cleanup = sub { run_command([@remcmd, 'rm', '-f', '--', $dest]) };
 	} else {
 	    PVE::Storage::activate_storage($cfg, $param->{storage});
 	    File::Path::make_path($dirname);
-- 
2.30.2





  parent reply	other threads:[~2021-08-31 10:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 10:16 [pve-devel] [PATCH-SERIES v4 http-server/storage/manager] fix #3505: add checksum and algorithm to iso upload Lorenz Stechauner
2021-08-31 10:16 ` [pve-devel] [PATCH v4 http-server 1/1] anyevent: move unlink from http-server to endpoint Lorenz Stechauner
2021-10-04  8:16   ` [pve-devel] applied: " Thomas Lamprecht
2021-08-31 10:16 ` [pve-devel] [PATCH v4 storage 1/4] status: move unlink from http-server to enpoint Lorenz Stechauner
2021-09-06  7:04   ` [pve-devel] applied: " Thomas Lamprecht
2021-08-31 10:16 ` [pve-devel] [PATCH v4 storage 2/4] status: remove sleep(1) in file upload Lorenz Stechauner
2021-08-31 10:16 ` [pve-devel] [PATCH v4 storage 3/4] fix #3505: status: add checksum and algorithm to " Lorenz Stechauner
2021-08-31 10:16 ` Lorenz Stechauner [this message]
2021-11-04 15:33   ` [pve-devel] partially applied: [PATCH v4 storage 4/4] status: fix tmpfile cleanup Thomas Lamprecht
2021-08-31 10:16 ` [pve-devel] [PATCH v4 manager 1/5] ui: move upload window into UploadToStorage.js Lorenz Stechauner
2021-11-05  8:12   ` Dominik Csapak
2021-08-31 10:16 ` [pve-devel] [PATCH v4 manager 2/5] ui: refactor UploadToStorage.js Lorenz Stechauner
2021-11-05  8:12   ` Dominik Csapak
2021-08-31 10:16 ` [pve-devel] [PATCH v4 manager 3/5] fix #3505: ui/UploadToStorage: add checksum and algorithm Lorenz Stechauner
2021-08-31 10:16 ` [pve-devel] [PATCH v4 manager 4/5] ui/UploadToStorage: add TaskViewer Lorenz Stechauner
2021-08-31 10:16 ` [pve-devel] [PATCH v4 manager 5/5] ui/UplaodToStorage: check file extension Lorenz Stechauner
2021-11-05  8:12   ` Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831101637.3080902-6-l.stechauner@proxmox.com \
    --to=l.stechauner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal