bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 10/11] utimes: detect utimes() correctly on OS/2 kLIBC


From: KO Myung-Hun
Subject: Re: [PATCH v7 10/11] utimes: detect utimes() correctly on OS/2 kLIBC
Date: Fri, 15 Jan 2016 13:18:18 +0900
User-agent: Mozilla/5.0 (OS/2; Warp 4.5; rv:10.0.6esrpre) Gecko/20120715 Firefox/10.0.6esrpre SeaMonkey/2.7.2


Paul Eggert wrote:
> On 01/13/2016 06:23 PM, KO Myung-Hun wrote:
>> address@hidden
>> +On OS/2, this funciton cannot set timestamp earlier than 1980 year in
>> local
>> +time.
>> address@hidden
>> +On OS/2, this function cannot set timestamp in odd seconds.
> 
> Misspelled "function", and some grammar issues. Please change to
> something like this:
> 
> On OS/2, this function cannot set the timestamp to earlier than the
> year 1980 in local time.
> @item
> On OS/2, this function cannot set the timestamp to an odd number of
> seconds.
> 
> 
>> +  /* On OS/2, a file date should be since 1980 year in local time
>> +     and even seconds.  */
> 
> Reword to "On OS/2, file timestamps must be on or after 1980 in local
> time, with an even number of seconds."
> 
>> +  static struct timeval timeval[2] = {{315620000 + 10, 10},
>> +                                      {315620000 + 1000000, 999998}};
>>       /* Test whether utimes() essentially works.  */
>>     {
>> @@ -82,15 +86,18 @@ main ()
>>             result |= 1;
>>           else if (fstat (fd, &st0) != 0)
>>             result |= 1;
>> +        else if (write (fd, "\n", 1) != 1)
>> +          result |= 1;
>> +        else if (fstat (fd, &st1) != 0)
>> +          result |= 1;
>> +        /* utimes() of OS/2 kLIBC does not work on an opened file */
>> +        else if (close (fd) != 0)
>> +          result |= 1;
>>           else if (utimes (file, timeval) != 0)
>>             result |= 2;
>>           else if (utimes (file, NULL) != 0)
>>             result |= 8;
>> -        else if (fstat (fd, &st1) != 0)
>> -          result |= 1;
>> -        else if (write (fd, "\n", 1) != 1)
>> -          result |= 1;
>> -        else if (fstat (fd, &st2) != 0)
>> +        else if (lstat (file, &st2) != 0)
>>             result |= 1;
>>           else if (time (&t2) == (time_t) -1)
>>             result |= 1;
>> @@ -103,7 +110,8 @@ main ()
>>               if (! (m_ok_POSIX || m_ok_NFS))
>>                 result |= 32;
>>             }
>> -        if (close (fd) != 0)
>> +        /* Ensure to close fd, but ignore an error if already closed. */
>> +        if (close (fd) != 0 && errno != EBADF)
>>             result |= 1;
>>         }
>>       if (unlink (file) != 0)
> 
> This doesn't look right, as the original order of updating the file's
> time stamps is needed to tickle the NFS bug. Instead, please change the
> code to attempt utimes() on the opened file, and if this fails the way
> that kLIBC fails, then close the file, invoke utimes on the file, and
> reopen the file. That way, the order will be preserved and there should
> be no need for any EBADF check.

Updated.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

Attachment: 0001-utimes-detect-utimes-correctly-on-OS-2-kLIBC.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]