y2038 and INLINE_SYSCALL

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Oct 14 12:00:27 GMT 2020



On 14/10/2020 05:09, Andreas Schwab wrote:
> On Okt 13 2020, Carlos O'Donell via Libc-alpha wrote:
> 
>>> Another issue is at locale/programs/localedef.c:
>>>
>>> 237   output_path  = construct_output_path (argv[remaining]);
>>> 238   if (output_path == NULL && ! no_archive)
>>> 239     error (4, errno, _("cannot create directory for output files"));
>>> 240   cannot_write_why = errno;
>>>
>>> Where construct_output_path will assume a successful stat won't touch
>>> errno (it is used on euidaccess).
>>
>> A successful stat shouldn't appear to touch errno. Internally it can
>> save and restore errno (like signal handlers are required to do).
>>
>> The ugly part is what does error () do on failure to flush or write to
>> the requisite streams. I'd expect it to touch errno. So I think the above
>> code should save errno first.
> 
> The call to error won't return, since it is called with a non-zero
> status.
> 
> Andreas.
> 

The issue is fact 'cannot_write_why' will be set to a non 0 value on
success on system that does not provide statx and later on

301   if (recorded_error_count == 0 || force_output != 0)
302     {
303       if (cannot_write_why != 0)
304         record_error (4, cannot_write_why, _("\
305 cannot write output files to `%s'"), output_path ? : argv[remaining]);

It will output a failure wrongly.


More information about the Libc-alpha mailing list