> The attached program gives EROFS at fgetpos() when called with FILE being
> on a read-only filesystem. I had no debug symbols installed, so I didn't
> track it down any further yet. From reading the stdio/fgetpos.c and ftell.c,
> I couldn't see how the filesystem was accessed even.
>
>

Hello Marcus,

Stepped your program through gdb, hope this is of some use.

Running this as a user damages somthing.  At the end of the trace, when gdb has
not replied to a step; the machine is nearly frozen.  If you try to do too many
things in other screens you lose control.

Using another screen, I switched to su, did a ps aux, then rebooted.  These were
the processes running after the gdb freeze:

Chris

Script started on Sat Apr 15 19:09:11 2000
cal@hurd:~$ gdb marcus
GNU gdb 19990928
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-gnu0.2"...
(gdb) list
1       #include <stdio.h>
2       #include <string.h>
3       #include <errno.h>
4       
5       main(int argc, char *argv[])
6       {
7       FILE *f;
8       fpos_t fpos;
9       
10        if (argc != 2) {
(gdb) b 10
Breakpoint 1 at 0x8048646: file marcus.c, line 10.
(gdb) run /Source/Marcus
Starting program: /home/cal/marcus /Source/Marcus
[Switching to thread 97.3]
[Switching to thread 97.4]

Breakpoint 1, main (argc=2, argv=0x1019ba0) at marcus.c:10
10        if (argc != 2) {
(gdb) info shared
>From        To          Syms Read   Shared Object Library
0x0101f000  0x0114ec64  Yes         /lib/debug/libc.so.0.2
0x00001000  0x000185d8  Yes         /lib/ld.so
0x0114f000  0x0115f340  Yes         /lib/debug/libmachuser.so.1
0x01161000  0x0117e284  Yes         /lib/debug/libhurduser.so.0.0
(gdb) list
5       main(int argc, char *argv[])
6       {
7       FILE *f;
8       fpos_t fpos;
9       
10        if (argc != 2) {
11           printf("Usage: %s FILE\n", argv[0]);
12           return;
13        }
14        f = fopen(argv[1], "r");
(gdb) list
15        if (!f) {
16           printf ("fopen: %s\n", strerror(errno));
17           return;
18        }
19        if (0 != fgetpos(f, &fpos)) {
20           printf ("fgetpos: %s\n", strerror(errno));
21        }
22        fclose(f);
23      }
(gdb) b 19
Breakpoint 2 at 0x80486b5: file marcus.c, line 19.
(gdb) cont
Continuing.

Breakpoint 2, main (argc=2, argv=0x1019ba0) at marcus.c:19
19        if (0 != fgetpos(f, &fpos)) {
(gdb) step
fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:31
fgetpos.c: Read-only file system.
(gdb) step
fgetpos.c: Read-only file system.
(gdb) step
ftell (stream=0x80499d0) at ftell.c:28
ftell.c: Read-only file system.
(gdb) step
ftell.c: Read-only file system.
(gdb) step
ftell.c: Read-only file system.
(gdb) step
__stdio_check_offset (stream=0x80499d0) at internals.c:101
internals.c: Read-only file system.
(gdb) step
init_stream (fp=0x80499d0) at internals.c:55
internals.c: Read-only file system.
(gdb) step
__stdio_check_funcs (fp=0x80499d0) at internals.c:37
internals.c: Read-only file system.
(gdb) bt
#0  __stdio_check_funcs (fp=0x80499d0) at internals.c:37
#1  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#2  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#3  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#4  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#5  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
internals.c: Read-only file system.
(gdb) step
internals.c: Read-only file system.
(gdb) step
__stdio_init_stream (stream=0x80499d0) at ../sysdeps/mach/hurd/stdio_init.c:38
../sysdeps/mach/hurd/stdio_init.c: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0)
    at ../sysdeps/mach/hurd/stdio_init.c:38
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../sysdeps/mach/hurd/stdio_init.c: Read-only file system.
(gdb) step
../hurd/hurd/threadvar.h: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0) at ../hurd/hurd/threadvar.h:81
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../hurd/hurd/threadvar.h: Read-only file system.
(gdb) step
../sysdeps/mach/i386/machine-lock.h: Read-only file system.
(gdb) step
../hurd/hurd/signal.h: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0) at ../hurd/hurd/signal.h:189
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../hurd/hurd/signal.h: Read-only file system.
(gdb) step
../hurd/hurd/signal.h: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0) at ../hurd/hurd/signal.h:190
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../sysdeps/mach/hurd/stdio_init.c: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0)
    at ../sysdeps/mach/hurd/stdio_init.c:43
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../hurd/hurd/port.h: Read-only file system.
(gdb) step
../mach/lock-intern.h: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0) at ../mach/lock-intern.h:48
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../sysdeps/mach/i386/machine-lock.h: Read-only file system.
(gdb) step
../hurd/hurd/signal.h: Read-only file system.
(gdb) step
../hurd/hurd/signal.h: Read-only file system.
(gdb) step
../hurd/hurd/threadvar.h: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0) at ../hurd/hurd/threadvar.h:81
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
../hurd/hurd/threadvar.h: Read-only file system.
(gdb) step
../sysdeps/mach/hurd/stdio_init.c: Read-only file system.
(gdb) bt
#0  __stdio_init_stream (stream=0x80499d0)
    at ../sysdeps/mach/hurd/stdio_init.c:43
#1  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#2  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#3  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#4  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#5  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#6  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
__io_stat (stat_object=91, stat_info=0x101999c)
    at /Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c:67
/Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c: Read-only file system.
(gdb) bt
#0  __io_stat (stat_object=91, stat_info=0x101999c)
    at /Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c:67
#1  0x1093e5c in __stdio_init_stream (stream=0x80499d0)
    at ../sysdeps/mach/hurd/stdio_init.c:43
#2  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#3  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#4  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#5  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#6  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#7  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
/Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c: Read-only file system.
(gdb) bt
#0  __io_stat (stat_object=91, stat_info=0x101999c)
    at /Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c:95
#1  0x1093e5c in __stdio_init_stream (stream=0x80499d0)
    at ../sysdeps/mach/hurd/stdio_init.c:43
#2  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#3  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#4  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#5  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#6  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#7  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
/Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c: Read-only file system.
(gdb) bt
#0  __io_stat (stat_object=91, stat_info=0x101999c)
    at /Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c:98
#1  0x1093e5c in __stdio_init_stream (stream=0x80499d0)
    at ../sysdeps/mach/hurd/stdio_init.c:43
#2  0x10918c1 in __stdio_check_funcs (fp=0x80499d0) at internals.c:39
#3  0x10918f1 in init_stream (fp=0x80499d0) at internals.c:55
#4  0x10919fc in __stdio_check_offset (stream=0x80499d0) at internals.c:101
#5  0x108ec21 in ftell (stream=0x80499d0) at ftell.c:36
#6  0x108ed1e in fgetpos (stream=0x80499d0, pos=0x1019b34) at fgetpos.c:37
#7  0x80486c5 in main (argc=2, argv=0x1019ba0) at marcus.c:19
(gdb) btstep
/Source/glibc-2.1.3/i386-gnu/obj/hurd/RPC_io_stat.c: Read-only file system.
(gdb) step
USER       PID %CPU %MEM    SZ   RSS TT STAT   START     TIME COMMAND
root       106  1.0  0.4  145M  796K p2 S     7:14PM  0:00.03 ps -aux
root        62  0.4  0.5  130M  932K  - So    7:04PM  0:01.04 /hurd/term /dev/p
root         4  0.4  1.6 1.09G 3.08M  - So    7:03PM  0:05.61 /hurd/ext2fs.stat
root        66  0.2  0.5  130M  920K  - So    7:04PM  0:01.24 /hurd/term /dev/p
root         8  0.2  0.5  130M  988K  - So    7:03PM  0:10.49 /hurd/term /dev/c
root         0  0.0  0.5  130M 1008K  ? R<mo  7:03PM  0:01.77 /hurd/proc
-            2  0.0  2.4  218M 4.64M  ? D<p   7:03PM  0:00.03 /boot/gnumach roo
-            3  0.0  0.5  128M 1.03M  ? Sp    7:03PM  0:00.18 ?
root         5  0.0  0.5  130M  992K  - So    7:03PM  0:00.44 /hurd/exec
root         6  0.0  0.4  129M  776K  - So    7:03PM  0:00.43 /hurd/auth
root        12  0.0  0.4  130M  880K  - So    7:03PM  0:00.02 /hurd/storeio hd0
root        16  0.0  0.4  129M  832K  - So    7:03PM  0:00.06 /hurd/null
root        17  0.0  0.5  130M  888K  - So    7:03PM  0:00.02 /hurd/storeio hd1
root        21  0.0  0.5  130M  892K  - So    7:03PM  0:00.03 /hurd/storeio hd1
root        22  0.0  0.5  130M  888K  - So    7:03PM  0:00.04 /hurd/storeio hd1
root        23  0.0  0.5  130M  892K  - So    7:03PM  0:00.06 /hurd/storeio hd0
root        41  0.0  0.4  130M  860K  - So    7:03PM  0:00.04 /hurd/pflocal
root        42  0.0  0.8  131M 1.62M  - So    7:03PM  0:00.14 /hurd/pfinet
root        43  0.0  0.5  130M  888K  - So    7:03PM  0:00.04 /hurd/storeio tim
root        44  0.0  0.6  130M 1.13M  - So    7:03PM  0:00.07 /hurd/password
root        46  0.0  0.7  1.1G  1.4M  - So    7:03PM  0:00.35 /hurd/ext2fs /dev
root        56  0.0  0.5  146M 1.03M co S     7:04PM  0:00.05 screen
cal         59  0.0  0.5  130M  888K  - So    7:04PM  0:01.12 /hurd/fifo
root        60  0.0  0.5  130M  956K  - So    7:04PM  0:00.90 /hurd/term /dev/p
root        64  0.0  0.5  130M  952K  - So    7:04PM  0:01.04 /hurd/term /dev/p
root        69  0.0  0.5  130M  924K  - So    7:05PM  0:00.39 /hurd/term /dev/p
root        76  0.0  0.8 1.09G 1.53M  - So    7:06PM  0:00.11 /hurd/ext2fs -r /
root        93  0.0  0.4  145M  836K p0 S     7:09PM  0:00.03 script screen2
root        94  0.0  0.3  145M  660K p0 Sf    7:09PM  0:00.06 script screen2
root        96  0.0  4.8  148M 9.15M p4 Sw    7:09PM  0:07.20 gdb marcus
cal         97  0.0  0.3  145M  588K  ? Tx    7:09PM  0:00.86 /home/cal/marcus
root       102  0.0  0.4  129M  748K  - So    7:13PM  0:00.02 /hurd/magic tty

Reply via email to