Jim Meyering wrote:
> On Fri, Dec 12, 2014 at 7:24 PM, KO Myung-Hun <[email protected]> wrote:
>>
>>
>> Jim Meyering wrote:
>>> On Wed, Dec 10, 2014 at 9:37 PM, KO Myung-Hun <[email protected]> wrote:
>>>> Jim Meyering wrote:
>>>>> On Tue, Nov 25, 2014 at 6:29 PM, KO Myung-Hun <[email protected]> wrote:
>>>>>> Hi/2.
>>>>>>
>>>>>> These are OS/2 patches.
>>>>>>
>>>>>> Review, please...
>>>>>>
>>>>>> [PATCH 1/2] build: use quotation mark(") for PATH
>>>>>> [PATCH 2/2] diff: skip test if seek is not possible on OS/2 kLIBC
>>>>>
>>>>> I saw no patches here, but was able to dig them out of the
>>>>> bug-tracking system at http://debbugs.gnu.org/19186.
>>>>> I have applied and pushed the first one.  Thank you.
>>>>>
>>>>> However, for the second, my inclination is that if at all possible,
>>>>> it should be fixed via an lseek replacement that does something
>>>>> more sensible. Of course, that may not be possible, but from
>>>>> what you've presented so far, I cannot tell. Please demonstrate
>>>>> a use of diff that shows how OS/2+kLIBC's lseek fails.
>>>>
>>>> Do you want this ?
>>>>
>>>> -----
>>>> $ cat file | diff - file
>>>> diff.exe: -: Invalid seek
>>>> -----
>>>
>>> Yes.  Thanks. That shows how lseek-pipe fails on your system.
>>> Please adjust your patch to make diff ignore failure only in that case,
>>> i.e., when errno == EINVAL (assuming strerror(EINVAL)
>>> produces that diagnostic).
>>
>> Do you mean to add errno == EINVAL to if() for pfatal_with_name() ?
> 
> No.
> Skip the test only when this lseek fails with precisely that errno value:
> 

Ok. Fixed.

-- 
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

>From 7b7ebe9c5716a39cff4478e6e83720b9a9648c62 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <[email protected]>
Date: Tue, 15 Jul 2014 11:50:53 +0900
Subject: [PATCH] diff: skip test if seek is not possible on OS/2 kLIBC

This fixes the problem that 'diff - file' and 'cat file | diff - file'
fail due to a seek failure with a message 'diff.exe: -: Invalid seek',
because seek does not work on stdin and a pipe on OS/2 kLIBC.

* src/io.c (sip): Set skip_test to true if seek is not possible on
OS/2 kLIBC.
---
 src/io.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/io.c b/src/io.c
index 1a8b936..e564f40 100644
--- a/src/io.c
+++ b/src/io.c
@@ -108,6 +108,13 @@ sip (struct file_data *current, bool skip_test)
                                     PTRDIFF_MAX - 2 * sizeof (word));
       current->buffer = xmalloc (current->bufsize);
 
+#ifdef __KLIBC__
+      /* Skip test if seek is not possible */
+      skip_test = skip_test
+                 || (lseek (current->desc, 0, SEEK_CUR) < 0
+                     && errno == ESPIPE);
+#endif
+
       if (! skip_test)
        {
          /* Check first part of file to see if it's a binary file.  */
-- 
1.8.5.2

Reply via email to