GNU bug report logs -
#17010
Bug#739752: coreutils: ln segfaults when run with --relative and an empty target
Previous Next
Reported by: Jim Meyering <jim <at> meyering.net>
Date: Fri, 14 Mar 2014 01:44:02 UTC
Severity: normal
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 03/14/2014 03:44 AM, Jim Meyering wrote:
> On Thu, Mar 13, 2014 at 7:22 PM, Pádraig Brady <P <at> draigbrady.com> wrote:
>> Interesting. So canonicalize_filename_mode() can fail in this case,
>> even with CAN_MISSING. It's unexpected that c_f_m() sets errno=ENOENT
>> when CAN_MISSING is set. I wonder should we change that instead
>> in gnulib? With CAN_MISSING I would expect this function to work
>> on arbitrary strings, including the empty string.
>
> What would you have c_f_m("", CAN_MISSING) return?
> I know of no absolute name corresponding to the dot-relative empty string.
Since with CAN_MISSING we should be just degenerating to string processing,
I would think it slightly better to return xstrdup(""),
to avoid special casing that in each caller.
I also notice that c_f_m() can return ENOMEM (from areadlink_with_size).
It's arguable that we should xalloc_die() within c_f_m()
for consistency in that case.
However I also notice that c_f_m("", CAN_MISSING) can return ENOENT
if the current working dir is unlinked. I'm not sure
there is anything else we could do within c_f_m() to handle that.
Hence since c_f_m() can validly fail even with CAN_MISSING,
I agree your patch is correct.
Please push.
thanks!
Pádraig.
This bug report was last modified 11 years and 74 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.