Bug#175755: fopen does not positions the stream at the end of the file in mode a+

0 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Ander

ungelesen,
07.01.2003, 18:00:1507.01.03
an
Package: libc6
Version: 2.3.1-8
Severity: critical

Opening a file with fopen in mode a+ will position the stream at the
begining of the file and not at the end.

I am using Debian GNU/Linux testing/unstable, kernel 2.4.19 and libc6
2.3.1-8

signature.asc

GOTO Masanori

ungelesen,
07.01.2003, 23:30:1207.01.03
an
At 07 Jan 2003 23:02:03 +0100,

Send us minimal test program.
You have to check below test. You find it works fine.

gotom:~> cat 175755.c
#include <stdio.h>

main()
{
FILE *fp;

fp = fopen("/tmp/aaa", "a+");

fwrite("a\n", 1, 2, fp);
}
gotom:~> cat /tmp/aaa
---------------
gotom:~> gcc 175755.c
gotom:~> ./a.out
gotom:~> cat /tmp/aaa
---------------
a
gotom:~>


-- gotom


--
To UNSUBSCRIBE, email to debian-gli...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Ander

ungelesen,
08.01.2003, 07:40:0808.01.03
an
El mié, 08-01-2003 a las 05:10, GOTO Masanori escribió:
> At 07 Jan 2003 23:02:03 +0100,
> Ander wrote:
> > Package: libc6
> > Version: 2.3.1-8
> > Severity: critical
> >
> > Opening a file with fopen in mode a+ will position the stream at the
> > begining of the file and not at the end.
> >
> > I am using Debian GNU/Linux testing/unstable, kernel 2.4.19 and libc6
> > 2.3.1-8
> >
>
> Send us minimal test program.
> You have to check below test. You find it works fine.
>
I have check your test and it works, but check this one:

#include <stdio.h>

int main(void)
{
FILE *archivo;
int pos;

archivo=fopen("main.c","a+");
pos=ftell(archivo);
printf("file pos after opening: %i\n",pos);
fseek(archivo,0,SEEK_SET);
pos=ftell(archivo);
printf("file pos after SEEK_SET: %i\n",pos);
fseek(archivo,0,SEEK_END);
pos=ftell(archivo);
printf("file pos after SEEK_END: %i\n",pos);
fclose(archivo);

return 0;
}

--

Ander Lozano Pérez
and...@wanadoo.es
http://perso.wanadoo.es/ander1 - http://diasce.es.gnome.org

signature.asc

Ander

ungelesen,
08.01.2003, 08:20:0708.01.03
an
It is like there was a problem with the coding of my previous mail, and
there is a "3D" before some of the functios. It is a mistake and the
"3D" should not be there.
signature.asc

GOTO Masanori

ungelesen,
08.01.2003, 09:40:0808.01.03
an
At 08 Jan 2003 12:56:10 +0100,
Ander wrote:
> [1 <text/plain; ISO-8859-15 (quoted-printable)>]
> El mi�, 08-01-2003 a las 05:10, GOTO Masanori escribi�:

Read the standard. XPG6 says:

a+ or ab+ or a+b Append; open or create file for update, writing
at end-of-file.

Opening a file with append mode (a as the first character in the
mode argument) shall cause all subsequent writes to the file to be
forced to the then current end-of-file, regardless of intervening
calls to fseek( ).

ISO C99:

a+ append; open or create text file for update, writing at
end-of-file

Opening a file with append mode (theathe as the first character in
the mode argument) causes all subsequent writes to the file to be
forced to the then current end-of-file, regardless of intervening
calls to the fseek function. In some implementations, opening a
binary file with append mode (thebthe as the second or third
character in the above list of mode argument values) may initially
position the file position indicator for the stream beyond the
last data written, because of null character padding.

When a file is opened with update mode (the+the as the second or
third character in the above list of mode argument values), both
input and output may be performed on the associated
stream. However, output shall not be directly followed by input
without an intervening call to the fflush function or to a file
positioning function (fseek, fsetpos,orrewind), and input shall
not be directly followed by output without an intervening call to
a file positioning function, unless the input operation encounters
end-of- file. Opening (or creating) a text file with update mode
may instead open (or create) a binary stream in some
implementations.

I guess you argue "opening a file with fopen in mode a+ will move file
position indicator in a stream at the end", but it's not true.

It's not bug. I close this report.

Ander

ungelesen,
08.01.2003, 10:10:1408.01.03
an

Sorry. In previos versions of libc6 the file position indicator was at
the end, and I thougth it was a bug.

signature.asc

Debian Bug Tracking System

ungelesen,
08.01.2003, 10:20:1308.01.03
an
Your message dated Wed, 08 Jan 2003 23:33:15 +0900
with message-id <8065sz...@oris.opensource.jp>
and subject line Bug#175755: fopen does not positions the stream at the end of the file in mode a+
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere. Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 7 Jan 2003 22:05:53 +0000
>From and...@wanadoo.es Tue Jan 07 16:05:53 2003
Return-path: <and...@wanadoo.es>
Received: from (smtpauth3.wanadoo.es) [62.37.236.135]
by master.debian.org with esmtp (Exim 3.12 1 (Debian))
id 18W1r6-0004Aj-00; Tue, 07 Jan 2003 16:05:53 -0600
Received: from localhost.localdomain (171.Red-80-35-98.pooles.rima-tde.net [80.35.98.171])
(authenticated)
by smtpauth3.wanadoo.es (8.11.3/8.11.3) with ESMTP id h07MHkx16211
for <sub...@bugs.debian.org>; Tue, 7 Jan 2003 23:17:47 +0100 (MET)
Subject: fopen does not positions the stream at the end of the file in mode
a+
From: Ander <and...@wanadoo.es>
To: sub...@bugs.debian.org
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature";
boundary="=-zhvBCtpncWq+qMWJcMTM"
X-Mailer: Ximian Evolution 1.0.5
Date: 07 Jan 2003 23:02:03 +0100
Message-Id: <1041976925.2548.19.camel@agaliaretph>
Mime-Version: 1.0
Delivered-To: sub...@bugs.debian.org
X-Spam-Status: No, hits=-1.2 required=5.0
tests=PGP_SIGNATURE_2,SPAM_PHRASE_00_01
version=2.41
X-Spam-Level:


--=-zhvBCtpncWq+qMWJcMTM
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Package: libc6
Version: 2.3.1-8
Severity: critical

Opening a file with fopen in mode a+ will position the stream at the
begining of the file and not at the end.

I am using Debian GNU/Linux testing/unstable, kernel 2.4.19 and libc6
2.3.1-8


--=-zhvBCtpncWq+qMWJcMTM
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje esta firmada digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQA+G05adimE5KRZnVsRApYFAJ0SPH0YJKzGH9ujfG0XgROrAKwB5QCeLdvR
Z1FuSvGWo8bZA1Ed4CErWRQ=
=k1Gh
-----END PGP SIGNATURE-----

--=-zhvBCtpncWq+qMWJcMTM--


---------------------------------------
Received: (at 175755-done) by bugs.debian.org; 8 Jan 2003 14:33:23 +0000
>From go...@debian.or.jp Wed Jan 08 08:33:22 2003
Return-path: <go...@debian.or.jp>
Received: from oris.opensource.jp (oris.opensource.gr.jp) [218.44.239.73] (postfix)
by master.debian.org with esmtp (Exim 3.12 1 (Debian))
id 18WHGj-0008TA-00; Wed, 08 Jan 2003 08:33:22 -0600
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.73])
by oris.opensource.gr.jp (Postfix) with ESMTP
id 0D069C351C; Wed, 8 Jan 2003 23:33:15 +0900 (JST)
Date: Wed, 08 Jan 2003 23:33:15 +0900
Message-ID: <8065sz...@oris.opensource.jp>
From: GOTO Masanori <go...@debian.or.jp>
To: Ander <and...@wanadoo.es>
Cc: GOTO Masanori <go...@debian.or.jp>, 17575...@bugs.debian.org,
debian...@lists.debian.org
Subject: Re: Bug#175755: fopen does not positions the stream at the end of the file in mode a+
In-Reply-To: <1042026974.427.7.camel@agaliaretph>
References: <1041976925.2548.19.camel@agaliaretph>
<80k7hg...@oris.opensource.jp>
<1042026974.427.7.camel@agaliaretph>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
(i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Delivered-To: 17575...@bugs.debian.org
X-Spam-Status: No, hits=-5.1 required=5.0
tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01,
SUBJ_HAS_SPACES,USER_AGENT
version=2.41
X-Spam-Level:

At 08 Jan 2003 12:56:10 +0100,
Ander wrote:
> [1 <text/plain; ISO-8859-15 (quoted-printable)>]

> El mi=EF=BF=BD, 08-01-2003 a las 05:10, GOTO Masanori escribi=EF=BF=BD:


> > At 07 Jan 2003 23:02:03 +0100,
> > Ander wrote:
> > > Package: libc6
> > > Version: 2.3.1-8
> > > Severity: critical

> > >=20


> > > Opening a file with fopen in mode a+ will position the stream at the
> > > begining of the file and not at the end.

> > >=20


> > > I am using Debian GNU/Linux testing/unstable, kernel 2.4.19 and libc6
> > > 2.3.1-8

> > >=20
> >=20


> > Send us minimal test program.
> > You have to check below test. You find it works fine.

> >=20


> I have check your test and it works, but check this one:

>=20
> #include <stdio.h>
>=20


> int main(void)
> {
> FILE *archivo;
> int pos;

>=20
> archivo=3Dfopen("main.c","a+");
> pos=3Dftell(archivo);


> printf("file pos after opening: %i\n",pos);
> fseek(archivo,0,SEEK_SET);

> pos=3Dftell(archivo);


> printf("file pos after SEEK_SET: %i\n",pos);
> fseek(archivo,0,SEEK_END);

> pos=3Dftell(archivo);


> printf("file pos after SEEK_END: %i\n",pos);
> fclose(archivo);

>=20

Allen antworten
Dem Autor antworten
Weiterleiten
0 neue Nachrichten