delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/12/12/05:26:15

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB2D23954E33
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1670840736;
bh=MJLQmiEXGOLfRVnCb+/BN26TdAldgQT2OeFMC1rRKYY=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=FXCmlEB9I3WWp+bjw/jr6gdcwqZA8o4DOPgLYMb4u/i/QMiAs7nrzYEOEEvUiacNV
CSkHTpgiBAIueBsSCw18RSvBXXTn2jBbMqEDhQZxWIXeoqZ+DNRZgvg0cvh9uFXTa5
CQC4hEDetgyt/9XZhoao1DuG5OmwJgS7bNkiX8io=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
Date: Mon, 12 Dec 2022 11:25:19 +0100
To: cygwin AT cygwin DOT com
Subject: Re: Regarding EFBIG error while opening a file using catopen()
function
Message-ID: <Y5cBj2AQ+dLAnsUm@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com, Kavita Gore <kavitagore02 AT gmail DOT com>
References: <CAM=9zcQsWHZ_udeTuz0wHFK9vPY1DitEGJVRM3s2-+Doa8L7jA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAM=9zcQsWHZ_udeTuz0wHFK9vPY1DitEGJVRM3s2-+Doa8L7jA@mail.gmail.com>
X-Provags-ID: V03:K1:5G+7HeZue30yRQsj67Zix5JPE9c6pjBokcZo0z3VHi5Kt6XFpQr
Mt0cIUGyv86uwG5AlXqP1O+uOk4lwRuQ7yEeiUWOX/yI98GEcN2A6izrhvj6FxsNIgOfWSg
t14gBg19RFKgp2I7JX/jjwCW8Gqi3T3JAwHtNRimWV3noxND8MpcPTebJetG9tq3p1JWMJx
PN2U3aut07ylPDBRz04Bg==
UI-OutboundReport: notjunk:1;M01:P0:FVsZpWfTvFo=;zIzLWi35zSm8LVz9NTNfTOnzhUe
6I03+TVSVjSxmb4F/jst3VkAyli5Slry89wG/10yyxGsWvk1k43jFzXVkm4QhUzAp8DOhbQgH
vWK0WOki/+2n0Ho6PmW0cvz2pNpBxIIYyLqqqbVkYyZPgdNhzIaPU0IxoMCoqqbkDmdCdcccR
f3Ojx2Ma1qGLaCvHRTuvF1VJKzVlNQkgVQfnNl3WjXD+UwuD4e97qrGhob5Zgvc0+Ecm/+XVO
npAiGOFOtCNuJE/rwIQiEO909havza+/Rs+Ohhd5VCVL5YCORC4uDb7AIQh2MO5AZOcQRFqGp
55gfMAQ/Vh0f8GrDoDe9YkXSvIPtp9WMMukzVnxv2eXbLE72TdrPjbA01YX6/mUcG2j0NqeBm
Xrgz5cB4mgN51qOMM4z5puS3ivKAPTSguyIb6iQRK5KkC/oudYyGajhZr4tvf7jX00bAe+Wak
tqKlgwyEpevs2Bc4OoE+ru0QDzgVeAJPzjUWA1DxsHhGyPgzE297YO550+AFNftLx2E6o3oen
0YAAd9lXMfnxEnOTSgS1S7D5gN2gE+HRKL/SsetrMgXb3oxB6am8CtnE2E9rFAlFxt/lajcVD
yMVuvoVllOba6OQAb2RtK7Oxz486N9zwFzl/RHLhW/fG+A6OEj4oUVFheUHXx2YKlzvNEDvow
FIx1zi3460o0/Q6D/nu9SkYanmQxrHTkkRl/QPpYpA==
X-Spam-Status: No, score=-95.5 required=5.0 tests=BAYES_00,
GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>,
Kavita Gore <kavitagore02 AT gmail DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

It's somewhat rude to send such a request to everybody and the kitchen
sink.

This belong on the cygwin ML, so please keep it here.

On Dec 12 10:40, Kavita Gore via Cygwin wrote:
> Hi all,
> 
> I'm getting errno 27[EFBIG] file too large while opening catalogue with
> catopen() function in the cygwin-32bit version.
> 
>  [...]
> #define FILENAME    TEMP.CAT
> 
>    buffer = catopen(FILENAME, 0);
>         if (buffer != (nl_catd) - 1)
>          {
>             printf("File open successfully");
>         }
>         else
>         {
>             printf("errno: %d\n", errno);
>         }
> 
> While debugging using gdb.I've found that st.st_size is 0 and As per my
> understanding struct stat.st_size is declared as off_t, which is most
> probably signed, and resolves to long (signed by default).

Since you're running gdb anyway, why don't you *ask* gdb what type
off_t is?

  (gdb) ptype off_t
  type = long long

> So if SIZE_T_MAX does not fit into 2^31-1 (it most probably does not) it
> will appear as negative in the comparison.

No, under implicit type conversion rules, the comparison is well
defined.  size_t is 32 bit on 32 bit systems, off_t is 64 bit.  So the
comparison will convert __SIZE_MAX__ losslessly to long long.  On 64 bit
systems, size_t is 64 bit, off_t is 64 bit.  The comparison will be
performed unsigned, thus it will never be true.

$ cat > x.c <<EOF
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>

int
main (int argc, char **argv)
{
  off_t o = strtoll (argv[1], NULL, 0);

  if (o > __SIZE_MAX__)
    puts ("too big");
}
EOF
$ gcc -g -o x x.c

On 32 bit:

$ ./x 0
$ ./x 1
$ ./x 0xffffffff
$ ./x 0x100000000
too big

On 64 bit:

$ ./x 0
$ ./x 1
$ ./x 0xffffffff
$ ./x 0x100000000
$ ./x 0xffffffffffffffff
$ ./x 0x7fffffffffffffff
$


> I'd like to know the reason why I'm getting this error and How it can be
> resolved as it is a blocker in my task.

You may have to debug this a bit further.


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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