[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17010: Bug#739752: coreutils: ln segfaults when run with --relative
From: |
Pádraig Brady |
Subject: |
bug#17010: Bug#739752: coreutils: ln segfaults when run with --relative and an empty target |
Date: |
Fri, 14 Mar 2014 11:49:53 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 03/14/2014 03:44 AM, Jim Meyering wrote:
> On Thu, Mar 13, 2014 at 7:22 PM, Pádraig Brady <address@hidden> 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.