From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Dietmar Maurer <dietmar@proxmox.com>
Subject: Re: [pve-devel] appllied: [PATCH] read firstline: only map ENOENT to undef, raise error otherwise
Date: Tue, 13 Jun 2023 07:32:57 +0200 [thread overview]
Message-ID: <34d9df36-1d16-f0e6-1cb8-8288fc9f1615@proxmox.com> (raw)
In-Reply-To: <1924874736.1129.1686634036299@webmail.proxmox.com>
Am 13/06/2023 um 07:27 schrieb Dietmar Maurer:
>> One could argue that the case for not existent should return undef,
>> while an empty file should return an empty string, but for that we
>> might want to check all use-sites first.
>
> AFAIR I use this function many times assuming that it does not throw errors in case of empty files. That is quite convenient.
Yes, and it still doesn't errors in that case. Above is talking about differentiating
the not-existing, empty file and empty first-line cases.
Currently (and before my patch) the behavior is:
- file does not exist -> undef
- file exists but empty -> undef
- file exists but first line empty -> ''
It would be a bit more expected to have the "file exists but empty" case also return
an empty string, but it probably doesn't matter.
prev parent reply other threads:[~2023-06-13 5:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 5:19 Thomas Lamprecht
2023-06-13 5:27 ` Dietmar Maurer
2023-06-13 5:32 ` Thomas Lamprecht [this message]
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=34d9df36-1d16-f0e6-1cb8-8288fc9f1615@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=dietmar@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