You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an object does not exist, this call to open will return -1, but errno is never checked:
open(), openat(), and creat() return the new file descriptor (a nonnegative integer), or -1 if an error occurred (in which case, errno is set appropriately).
– open(2)
It then proceeds to initialise the backend object, and returns false. But the return value is ignored, and the object is then passed to other backend operations, as if initialization succeeded:
The invalid file descriptor -1 is then passed to pread here, which writes EBADF to errno. This error never reaches the client though, who receives no indication of an error, and doesn't receive any data. It appears to the client, as if the object existed but was empty.
With a server posix backend configured, this can be reproduced simply by trying to copy any non-existing object with julea-cli:
$ bld/julea-cli copy object://host/namespace/bar file:///tmp/foo
# in the gdb session attached to julea-server
(gdb) b backend_read
Function "backend_read" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (backend_read) pending.
(gdb) r
Starting program: /home/tilpner/dev/betree/julea/bld/julea-server
[New LWP 12178]
[New LWP 12393]
[Switching to LWP 12393]
Thread 3 "pool-julea-serv" hit Breakpoint 1, backend_read (backend_data=0x423d00,
backend_object=0x7fffdc003250, buffer=0x7fffe8d8d010, length=1048576, offset=0,
bytes_read=0x7fffe9d8ce68) at ../backend/object/posix.c:313
313 j_trace_file_begin(bo->path, J_TRACE_FILE_READ);
(gdb) p bo->fd
$1 = -1
# step until after pread
(gdb) p (void(*)(char*))perror("")
Bad file descriptor
$6 = (void (*)(char *)) 0x0
The text was updated successfully, but these errors were encountered:
If an object does not exist, this call to
open
will return-1
, buterrno
is never checked:https://github.com/julea-io/julea/blob/be6065355938c0e10886466e933c1c99d262b77f/backend/object/posix.c#L206-L210
It then proceeds to initialise the backend object, and returns false. But the return value is ignored, and the object is then passed to other backend operations, as if initialization succeeded:
https://github.com/julea-io/julea/blob/be6065355938c0e10886466e933c1c99d262b77f/server/loop.c#L139-L141
The invalid file descriptor
-1
is then passed topread
here, which writes EBADF toerrno
. This error never reaches the client though, who receives no indication of an error, and doesn't receive any data. It appears to the client, as if the object existed but was empty.https://github.com/julea-io/julea/blob/be6065355938c0e10886466e933c1c99d262b77f/backend/object/posix.c#L318-L320
With a server posix backend configured, this can be reproduced simply by trying to copy any non-existing object with julea-cli:
The text was updated successfully, but these errors were encountered: