X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4892F391F301
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1670821848;
	bh=A9OQTpe7/ot37FhUit49le7aLGHVsACtTvmHPyaPmGU=;
	h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive:
	 List-Post:List-Help:List-Subscribe:From:Reply-To:From;
	b=ZUFVCaNjD5mPKgz29agNE5tNY/PaNl5Vh2TXKcWWaDzI++fbWgGXEv2K6sRhILxuN
	 /NYXhve8jzF0pNFw5yd/+t+OyjrWiq9ntOfyuGcHLZhMN+s37GqfETXnpsoXy/JZSt
	 Q7oyvWI4z7VIBoG+WSfPGDL0vK+EXuN/Qzce3MhM=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6BDA0391B45A
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=1ucVtBjqfSYtACkHKQ9CU95Ze1aG99ochnraO3255wU=;
 b=3fZPeeXuV7LWSeSoYBSFUIWPer7SL3IjLcJlfMPPQx7XDNsp5zxPr5/P+YHKkub3rT
 UUI4sP8US5l16WyaHKhvo2TTibH888VvBiyBLfn3gtpg+xdbUArTvfv4uw3XB3dFYqYW
 1QbGVRoU1FORVUSZWCge8lavHFCx90WSDOpMU8aSm2Dj8j7EownUlZpD9QBoVW69KDYJ
 UygJHdbeqlT+FU8UuyXPqO3GNDS+9V/GqzbrldJ0N8SDfFvtmTN0VzcIgvSZ+miVuYm4
 UWodh8AxQh2uwjA0UVzK8ZQdtbO3VLHV3eU6WAXVKtvehh6dRTg7o6tsVQDMnN9UwU3I
 44cA==
X-Gm-Message-State: ANoB5pln6FRDTLUOoxK4LcynpenAzvaCwe2rnBlu+fdMoGhrgq69nwTF
 s/2BbXhxdk1q88iXjOSVDfwgvNsrs2oFW5JgUeOelDxy08SmDg==
X-Google-Smtp-Source: AA0mqf4zo/NCZMDOP77tFE+1NzE8DM3HfYMbYVeZYV2x+xRRecTME/Sx2JkNQzHOcdKXBmfZgixNZ8Z6z7EUef3tXUA=
X-Received: by 2002:aa7:8d5a:0:b0:560:eec2:d0ab with SMTP id
 s26-20020aa78d5a000000b00560eec2d0abmr98642872pfe.43.1670821832035; Sun, 11
 Dec 2022 21:10:32 -0800 (PST)
MIME-Version: 1.0
Date: Mon, 12 Dec 2022 10:40:20 +0530
Message-ID: <CAM=9zcQsWHZ_udeTuz0wHFK9vPY1DitEGJVRM3s2-+Doa8L7jA@mail.gmail.com>
Subject: Regarding EFBIG error while opening a file using catopen() function
To: cygwin@cygwin.com, cygwin-owner@cygwin.com, mailman@cygwin.com,
        cygwin-developers@cygwin.com, cygwin-developers-owner@cygwin.com
Cc: parulsoni799@gmail.com, atulpathare226@gmail.com, rajeshrube@gmail.com
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
 FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
 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-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Kavita Gore via Cygwin <cygwin@cygwin.com>
Reply-To: Kavita Gore <kavitagore02@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

Hi all,

I'm getting errno 27[EFBIG] file too large while opening catalogue with
catopen() function in the cygwin-32bit version.



Trying to open a .cat file but catopen() returns a file too large [EFBIG]
error.



this is the code snippet I was working with:



#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).

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.

I suspect like off_t is supposed to be signed, and size_t is supposed to be
unsigned, both according to POSIX.

That means, this comparison has definitely a signedness issue.

So that's why if condition getting success and returning errno 27(EFBIG).



Coding snippet where if condition getting succeed:

Msgcat.c:

=======

if (st.st_size > SIZE_T_MAX) {

        _close(fd);

        SAVEFAIL(name, lang, EFBIG);

        NLRETERR(EFBIG);

    }


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.


Regards,

Kavita.

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