public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH storage] api: upload: correctly test for result of unlink
Date: Tue, 30 Jul 2024 10:21:42 +0200	[thread overview]
Message-ID: <749e853a-5dd0-446e-967d-f8058fcd1be2@proxmox.com> (raw)
In-Reply-To: <098ccae5-6efa-4898-9ca0-f8478f43959d@proxmox.com>

Am 29.07.24 um 18:50 schrieb Thomas Lamprecht:
> Am 29/07/2024 um 16:29 schrieb Fiona Ebner:
>> It's not enough to check whether $! is set. From "perldoc perlvar":
>>
>>> Many system or library calls set "errno" if they fail, to
>>> indicate the cause of failure. They usually do not set "errno"
>>> to zero if they succeed and may set "errno" to a non-zero value
>>> on success. This means "errno", hence $!, is meaningful only
>>> *immediately* after a failure:
>>
>> To protect against potential issues, check the return value of unlink
>> and only check $! if it failed.
> 
> fine by me, but out of interest: any reason for why this is done now,
> i.e., did this really cause trouble or is this done out of precaution?

Sorry, while the commit message hints at it with "protect against
potential issues", I could've been more explicit. I stumbled upon an old
branch with this patch. Most likely I wrote it after needing the same
logic with unlink for something else. I don't know about any concrete
issues.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2024-07-30  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 14:29 Fiona Ebner
2024-07-29 16:50 ` Thomas Lamprecht
2024-07-30  8:21   ` Fiona Ebner [this message]
2024-09-12 10:13 ` [pve-devel] applied: " Thomas Lamprecht

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=749e853a-5dd0-446e-967d-f8058fcd1be2@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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