delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:reply-to | |
:references:mime-version:content-type:in-reply-to; q=dns; s= | |
default; b=ZImJbLeGfjua5nJA48kDuTpEXV4MpJXq0djDiOfbMz6MIBIUzSqU+ | |
KkkiwfipO8JZPJje/xSG2s/zWEK/kN/wmkvymvQ2dzXFjb06FtRf7yMOTN8vlFMX | |
jYOmtVpt9tS3D2BI9f/tjppOMFSK33N0I4l/JKPZSzpp2iqSAVHpwY= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:reply-to | |
:references:mime-version:content-type:in-reply-to; s=default; | |
bh=0cQVxVWuHy9JEuufcVqb1foAsfM=; b=DxsodFPTPaLzNLxpaiwJghTabCBy | |
RHIrSYXnX4vLzcNgPB8dRdDLkBCksHhykaTYfFA4HsWNxBTdjQeDbAdBuLVa8jWU | |
SfwMb7m1gqWyR0Ds9rAuxO419oWX7/LsvM4MHZnml4TrLyTBPlpyXpvEHVhezcj4 | |
akpkAdGi7S6a7UY= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=-0.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
X-HELO: | calimero.vinschen.de |
Date: | Mon, 13 Jan 2014 13:09:33 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: nested popen()'s lead to fgets() failure on 64-bit only |
Message-ID: | <20140113120933.GA21977@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <18833-1389579359 DOT 738859 AT Poig DOT bVYt DOT cj35> |
MIME-Version: | 1.0 |
In-Reply-To: | <18833-1389579359.738859@Poig.bVYt.cj35> |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
--UugvWAfsgieZRqgk Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jan 12 21:15, David Levine wrote: > Hi, >=20 > The program below works just fine on 32-bit Cygwin: > buf1 =3D /usr/bin/file.exe > buf2 =3D /usr/bin/file.exe: application/x-dosexec >=20 > But on 64-bit Cygwin (2.831), the second fgets() fails: That's the version number of the setup-x86_64.exe tool, not the version number of Cygwin. Try `uname -r'. > buf1 =3D /usr/bin/file.exe > fgets2: No error >=20 > It only seems to happen with nested popen()'s. Is it due to a > problem in the Cygwin lib? Works fine for me on Cygwin 1.7.27: $ uname -rm 1.7.27(0.271/5/3) x86_64 $ file --version file-5.13 magic file from /usr/share/misc/magic $ ./popen-test buf1 =3D /usr/bin/file.exe buf2 =3D /usr/bin/file.exe: application/x-dosexec $ The fact that fgets returns NULL doesn't mean an error occured. fgets also returns NULL at EOF, meaning no output in this case, which you should test, too: if (fgets(buf2, sizeof buf2, f2)) printf(" buf2 =3D %s", buf2); else if (feof (f2)) fputs ("fgets2 EOF\n", stderr); else perror("fgets2"); Maybe you're calling the wrong file command? What's your $PATH set to? What if you change your popen call to run /usr/bin/file.exe with full path? if ((f2 =3D popen("/usr/bin/file --mime-type /usr/bin/file.exe", "r"))) Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --UugvWAfsgieZRqgk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJS09d9AAoJEPU2Bp2uRE+gGGoP/j5UEFtStoE7GIXlvRq3LHT4 599RY+98bMhNNPP21ElbfDN0RHLJBwFW2oQWFnzhxHV39mui+iwxnmJCuNvurv1C a1FY586W9oILGrcKZHMi3NiY79yECpbKkqfmk5F2TalIvprsP70JdwuRE2IvwkeA CjK2bJoP5kavCqz5mG146rLsSrAuAOWp4VsEakkQfmFT7yJ/WzMqsJ8tDVsA2RNq vVVO2Fou1B/XLkQF1YAEzenwBdou/YF3hW8YHH9BTywUKOq+oVdxREHkKmLHfaPh CbkSkS7IwSSG3aTA1hgl/J3BLxz3Jst6JLUWpoHf6q0IX/8yzTXFZw4BcXspTk2u gpExMAExtnZQ554IMPzDFOKu1MnWteLvEqshqnKdcKX60k+kEaqGzz0A7w/KXHa3 UxpwcT7ym7ZCEq0MvtePdOmqZcIIjXbE/nxK6jlQ8Obu7gs6OuXKMKqlA8ZOucgS Qz0ivSQeDUcXglmbH9XS7ty9MosGHQDTanKrZSMWGqVvDGGZ2bB4JLa4GeVrUlh6 1RSYIuo9j43LMu8oiwl2mfNKMP8z2I5XYg7wPjwGUK6WHLcMPdPRyWQ5O1MM7MkH EDUpa/4stfM+fW86myCCYhesbnEp7PaLtDUc9xUtvWMkRh/sZqRlWKBZjfakrz4T PY/c6RFEztGE3AndX0XP =X508 -----END PGP SIGNATURE----- --UugvWAfsgieZRqgk--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |