delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2016/10/25/19:18:56

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
bh=cS6SI5A+sJq+BTyy0WTK4Qe1E0eunvrs1HJBGTwHSqg=;
b=FqgazgVcVaI/xkdhm21tfQ4nG+XQNyXWiODhgU+OQ23FyXyZROt4pFd8oy1ewvBvyL
5Bal7+keRrfPtSijDkCLGNW8V3kIL79+GRmIRxkz0qmN7Bf6eikdzq1QHtu360UKZYlR
uNzUMKpYcXonEmPIX3pJMjIAaUIn3cYtQmpPFH0AqXzUZgvZu66tcxJGgHT07UD5rX/9
6STUjCNjN0vAPKT8aboVP51mtr48ahyh830PsqBtUuF8h2d9FAi2uoom5+olapYZwXJh
wFPEGN8EvzgdKXoLT6qffOsLM7zdT3soWOPENFoQQTOPS1vj3xsQ0VIRZeFvkU8owC04
Envg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to;
bh=cS6SI5A+sJq+BTyy0WTK4Qe1E0eunvrs1HJBGTwHSqg=;
b=KiNSr0o/vnF7Gz48k1Esn6TcDTiVbxPR0wzb6CSA/doEb85qan87I9LHsshajbDbqY
PW4IVZc7gPNoV7m/HHEekir9P01zHdwL3pP4JuPSDZy9spnq/w6LawCpaz9ECv7rZeDd
l/5+n8e/84TESCDy9+RUBLEuS8Se9GIIVr9//egjka4ZT64SWJLsXn8Kgq4XEwwMjZyd
/uQn7hruyGFYAsLjsrrdM6h6qf8xWLv1U7lxTgxWYvVDO+H4Js+RLci08PsE599Yf1HL
aZXx7op/IzF3qeVIZ0MZbvVJ9U3hsp/yO8wo1bpzpJqToa8CaTgqls0pZ+jq+QBMXO2Q
UjBw==
X-Gm-Message-State: ABUngvd6TfPcPCCfgkhJmHq5asMvSx77iBjNkfK5CQHFC/w+RMIMLZyTaZelDdu76bMCCBRoOTGR8wzD5zGPkg==
X-Received: by 10.107.181.12 with SMTP id e12mr17528953iof.217.1477436010897;
Tue, 25 Oct 2016 15:53:30 -0700 (PDT)
MIME-Version: 1.0
In-Reply-To: <580FC5AA.5010009@gmx.de>
References: <580BCAA5 DOT 2000304 AT gmx DOT de> <83d1irppmj DOT fsf AT gnu DOT org>
<580D0638 DOT 8080605 AT gmx DOT de> <numomu$png$1 AT gioia DOT aioe DOT org> <580FC5AA DOT 5010009 AT gmx DOT de>
From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Date: Wed, 26 Oct 2016 01:53:30 +0300
Message-ID: <CAA2C=vAoD1-6xe4tbW_-fuc1pT0=goG+tV-c6OocwB2WOUdDaQ@mail.gmail.com>
Subject: Re: A grep 2.26 test fails because fopen sets errno to EACCES when
openning an existing directory.
To: djgpp AT delorie DOT com
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 10/25/16, Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via
djgpp AT delorie DOT com] <djgpp AT delorie DOT com> wrote:
> Am 25.10.2016 06:57, schrieb Martin Str|mberg (ams AT ludd DOT luth DOT se) [via
> djgpp AT delorie DOT com]:
>> "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via
>> djgpp AT delorie DOT com]"<djgpp AT delorie DOT com>  wrote:
>>> I have compiled grep-2.26 with cygwin, debian 8.2.0 and openSUSE 11.4 (my
>>> linux box).
>>> They all return EISDIR for the failing fread.  These seems to indicate
>>> that
>>> EISDIR is the defacto value that have been choosen for this fread
>>> failure.
>>
>> How about looking at the documentation?
>>
>> fread() isn't documented to use errno (not in C99 (sorry that's the
>> latest I have, nor in the latest man page for linux
>> <http://man7.org/linux/man-pages/man3/fread.3.html>  (I arrived there
>> from<https://www.kernel.org/doc/man-pages/>)), so you've found a bug
>> in the test suite as in that case it's plainly wrong to look at errno.
>>
>>
>> However, you are one of the few maintaining poor DJGPP, so you're
>> welcome to do what you see fit.
>>
>>
>
> IMHO, there is neither an error in grep nor in the testsuite.  They simple
> expect a posix comforming behavior of fopen and fread.  According to the
> man pages of my almost 10-year old linux box the following shall hold for
> a posix conforming fread (verbatim copy):
>
> RETURN VALUE
>         Upon  successful  completion,  fread() shall return the number of
> ele-
>         ments successfully read which is less than nitems only if a read
> error
>         or  end-of-file  is encountered. If size or nitems is 0, fread()
> shall
>         return 0 and the contents of the array and the  state  of  the
> stream
>         remain unchanged. Otherwise, if a read error occurs, the error
> indica-
>         tor for the stream shall be set,  and errno shall be set  to
> indicate
>         the error.
>

FWIW, my 8-year-old fedora9 from 2008 (glibc-2.8) say:
"fread()  and  fwrite()  return  the  number  of  items successfully
read or written (i.e., not the number of characters).  If an error
occurs, or the end-of-file is reached, the return value is a short
item count (or zero)."
... without mentioning errno.


> I have also inspected
> http://pubs.opengroup.org/onlinepubs/009695399/functions/fread.html
> and it states the same.  Unfortunately nobody says what the errnos are.
>
> But I fear that the issue is far more complicated.  The errno itself is not
> really important.  Important is the exit value of grep and this should be 2
> but it is 1 for the DJGPP port.  The test issues the following command:
>    ./grep -f a/ < /dev/null
> and a/ is an empty directory.  The directory is open using fopen and read
> using fread.  On linux and djgpp fread returns with a value of zero and the
> error status is indagated using ferror.  The linux port returns with some
> error
> and terminates the program immediately with grep status = 2 meanwhile the
> djgpp
> port sees no error at all an continues running until it finishes with grep
> status = 1 making the check fail.  I still have not figured out what is
> going
> on here.  I will see how to fix all this.
>
> Regards,
> Juan M. Guerrero
>
>

--
O.S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019