[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#287824: marked as done (libc6: fseek() fails and returns -1 without setting errno)

Your message dated Wed, 26 Jan 2005 23:01:28 +0900
with message-id <81acqwp9vr.wl@omega.webmasters.gr.jp>
and subject line Bug#287824: libc6: fseek() fails and returns -1 without setting errno
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; 30 Dec 2004 11:42:51 +0000
>From walles@mailblocks.com Thu Dec 30 03:42:51 2004
Return-path: <walles@mailblocks.com>
Received: from av10-1-sn2.hy.skanova.net [] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1Cjyhe-0004on-00; Thu, 30 Dec 2004 03:42:50 -0800
Received: by av10-1-sn2.hy.skanova.net (Postfix, from userid 502)
	id 988C1380E4; Thu, 30 Dec 2004 12:42:19 +0100 (CET)
Received: from smtp4-1-sn2.hy.skanova.net (smtp4-1-sn2.hy.skanova.net [])
	by av10-1-sn2.hy.skanova.net (Postfix) with ESMTP
	id 8683D380CB; Thu, 30 Dec 2004 12:42:19 +0100 (CET)
Received: from localhost (h240n1fls305o1034.telia.com [])
	by smtp4-1-sn2.hy.skanova.net (Postfix) with ESMTP id 6AD2A37E47;
	Thu, 30 Dec 2004 12:42:19 +0100 (CET)
Received: from johan by localhost with local (Exim 3.36 #1 (Debian))
	id 1Cjyh8-0003G4-00; Thu, 30 Dec 2004 12:42:18 +0100
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Johan Walles <walles@mailblocks.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libc6: fseek() fails and returns -1 without setting errno
X-Mailer: reportbug 3.2
Date: Thu, 30 Dec 2004 12:42:18 +0100
Message-Id: <E1Cjyh8-0003G4-00@localhost>
Sender: Johan Walles <johan@localhost.localdomain>
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
	autolearn=no version=2.60-bugs.debian.org_2004_03_25

Package: libc6
Version: 2.3.2.ds1-18
Severity: normal

The output of the following program is:
johan@foo:~/src/test$ ./a.out
fseek: Unknown error 12345

Since I set errno to 12345 before making the (failing) fseek() call,
fseek() itself apparently fails without setting errno.

Here's the strace output between opening the file and failing:
open("/proc/self/mem", O_RDONLY)        = 3
fstat64(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe8000
_llseek(3, 18446744072635807744, [3526037055030344891], SEEK_SET) = -1073743872
dup(2)                                  = 4
fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
fstat64(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 5), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe7000
_llseek(4, 0, 0xbffff768, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(4, "fseek: Unknown error 12345\n", 27fseek: Unknown error 12345
) = 27

And the program itself:

/* The point of this program is to try to access one of its own local
 * variables by reading it from /proc/self/mem. */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char *argv[])
  int variable = 42;
  int readvalue = 0;
  FILE *mem = fopen("/proc/self/mem", "r");
  errno = 12345;
  if (fseek(mem, (size_t)&variable, SEEK_SET) != 0) {
  if (fread(&readvalue, sizeof(variable), 1, mem) != 1) {
  printf("Localvar=%d, read value=%d\n", variable, readvalue);
  return 0;

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-1-686
Locale: LANG=sv_SE, LC_CTYPE=sv_SE (charmap=ISO-8859-1)

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information

Received: (at 287824-done) by bugs.debian.org; 26 Jan 2005 14:01:31 +0000
>From gotom@debian.or.jp Wed Jan 26 06:01:31 2005
Return-path: <gotom@debian.or.jp>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1Ctnjf-0007KA-00; Wed, 26 Jan 2005 06:01:31 -0800
Received: from omega.webmasters.gr.jp (localhost [])
	by webmasters.gr.jp (Postfix) with ESMTP
	id 4C21ADEB3B; Wed, 26 Jan 2005 23:01:28 +0900 (JST)
Date: Wed, 26 Jan 2005 23:01:28 +0900
Message-ID: <81acqwp9vr.wl@omega.webmasters.gr.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: Johan Walles <walles@mailblocks.com>, 287824-done@bugs.debian.org
Cc: gotom@debian.or.jp
Subject: Re: Bug#287824: libc6: fseek() fails and returns -1 without setting errno
In-Reply-To: <81vfa0rgcy.wl@omega.webmasters.gr.jp>
References: <E1Cjyh8-0003G4-00@localhost>
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=US-ASCII
Delivered-To: 287824-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02

> I send my interpretation to debian-kernel to make sure.  Debian-kernel
> guys, if you don't agree with my thought, please let me know.
> Otherwise, I'll close this bug.

I believe this report does not focus the correct usage for using
/proc/self/mem + fseek().  I close this bug.  Johan, if you have doubt
about this close, please read again my reply.

-- gotom

Reply to: