Skip to content

mv file into dir not working on Ubuntu 24 #214

Description

@reidsunderland

The test failures we see on Ubuntu 24 on GitHub, https://github.com/MetPX/sarrac/actions/runs/15786279634/job/44503274532?pr=213 also occur on an Ubuntu 24 VM.

e.g. for test_shim_copy_strip:

+ mv test_file dirthree

+ sleep 10

RESULT: BAD! missing expected {'rename': 1} for 152 move test_file into dirthree subdir

I don't see any log messages complaining about a not-implemented syscall.

strace -f bash -c './shim_copy_strip.sh >shim_copy_strip.log 2>&1' > ../straceout.txt 2>&1

shows that a message is not posted because some file is read only (I assume fd 3?) (I realized that message was irrelevant)

[pid 969065] ioctl(0, TCGETS, 0x7ffdf14657a0) = -1 ENOTTY (Inappropriate ioctl for device)
[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0813928 ", 32) = 32
[pid 969065] write(2, "renameat2 test_file dirthree\n", 29) = 29
[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0814726 ", 32) = 32
[pid 969065] write(2, " renameorlink test_file dirthree"..., 33) = 33
[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0815551 ", 32) = 32
[pid 969065] write(2, " renameorlink using renameat2\n", 30) = 30

[pid 969065] renameat2(AT_FDCWD, "test_file", AT_FDCWD, "dirthree", RENAME_NOREPLACE) = -1 EEXIST (File exists)

[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0816729 ", 32) = 32
[pid 969065] write(2, " renameorlink test_file dirthree"..., 49) = 49

[pid 969065] openat(AT_FDCWD, "dirthree", O_RDONLY|O_PATH|O_DIRECTORY) = 3

[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0817986 ", 32) = 32
[pid 969065] write(2, "renameat2 test_file test_file\n", 30) = 30
[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0818994 ", 32) = 32
[pid 969065] write(2, " renameorlink test_file test_fil"..., 34) = 34
[pid 969065] write(2, "SR_SHIMDEBUG 1 969065 0.0819783 ", 32) = 32
[pid 969065] write(2, " renameorlink using renameat2\n", 30) = 30

[pid 969065] renameat2(AT_FDCWD, "test_file", 3, "test_file", RENAME_NOREPLACE) = 0

[pid 969065] write(2, "SR_SHIMDEBUG 9 969065 0.0821166 ", 32) = 32
[pid 969065] write(2, "srshim_initialize shim about to "..., 47) = 47
[pid 969065] newfstatat(AT_FDCWD, "/local/home/sarra/.config/sr3/credentials.conf", {st_mode=S_IFREG|0664, st_size=860, ...}, 0) = 0
[pid 969065] write(2, "SR_SHIMDEBUG 2 969065 0.0822546 ", 32) = 32
[pid 969065] write(2, "fopen /local/home/sarra/.config/"..., 55) = 55
[pid 969065] openat(AT_FDCWD, "/local/home/sarra/.config/sr3/credentials.conf", O_RDONLY) = 4
[pid 969065] fstat(4, {st_mode=S_IFREG|0664, st_size=860, ...}) = 0
[pid 969065] read(4, "amqp://root:removed@localhost\n\n"..., 4096) = 860
[pid 969065] fcntl(4, F_GETFL)          = 0x8000 (flags O_RDONLY|O_LARGEFILE)
[pid 969065] write(2, "SR_SHIMDEBUG 5 969065 0.0824909 ", 32) = 32
[pid 969065] write(2, " fclose 0x5bf48ccdb2a0 fd=4 fdst"..., 52) = 52
[pid 969065] write(2, "SR_SHIMDEBUG 5 969065 0.0825713 ", 32) = 32

# this is fd 4, not fd 3, I don't think it's related
[pid 969065] write(2, " fclose NO POST read-only. fd=4\n", 32) = 32

[pid 969065] close(4)                   = 0

and the log shows renameorlink test_file test_file

SR_SHIMDEBUG 1 969065 0.0813928 renameat2 test_file dirthree                                                                                                                                                                SR_SHIMDEBUG 1 969065 0.0814726  renameorlink test_file dirthree
SR_SHIMDEBUG 1 969065 0.0815551  renameorlink using renameat2
SR_SHIMDEBUG 1 969065 0.0816729  renameorlink test_file dirthree failed, no post
SR_SHIMDEBUG 1 969065 0.0817986 renameat2 test_file test_file
SR_SHIMDEBUG 1 969065 0.0818994  renameorlink test_file test_file
SR_SHIMDEBUG 1 969065 0.0819783  renameorlink using renameat2
SR_SHIMDEBUG 9 969065 0.0821166 srshim_initialize shim about to sr_config_init
SR_SHIMDEBUG 2 969065 0.0822546 fopen /local/home/sarra/.config/sr3/credentials.conf r
SR_SHIMDEBUG 5 969065 0.0824909  fclose 0x5bf48ccdb2a0 fd=4 fdstat=100000, starting
SR_SHIMDEBUG 5 969065 0.0825713  fclose NO POST read-only. fd=4

Manually stracing mv test_file dirthree shows this (on Ubuntu 24):

renameat2(AT_FDCWD, "test_file", AT_FDCWD, "dirthree", RENAME_NOREPLACE) = -1 EEXIST (File exists)
openat(AT_FDCWD, "dirthree", O_RDONLY|O_PATH|O_DIRECTORY) = 3
renameat2(AT_FDCWD, "test_file", 3, "test_file", RENAME_NOREPLACE) = 0

On Ubuntu 22, it's a bit different:

renameat2(AT_FDCWD, "test_file", AT_FDCWD, "dirthree/", RENAME_NOREPLACE) = -1 EEXIST (File exists)
newfstatat(AT_FDCWD, "dirthree/", {st_mode=S_IFDIR|0755, st_size=157, ...}, 0) = 0
renameat2(AT_FDCWD, "test_file", AT_FDCWD, "dirthree/test_file", RENAME_NOREPLACE) = 0

So on Ubuntu 22, it's using AT_FDCWD as the old and new dir FDs, and renaming test_file to dirthree/test_file. On Ubuntu 24, it opens the destination directory (as FD 3) and renames from AT_FDCWD test_file to FD 3 (=dirthree) test_file.

int renameat2(int olddirfd, const char *oldpath,
                    int newdirfd, const char *newpath, unsigned int flags);

I think I have to add some more debug logging to figure out where libsr3shim is going wrong.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingmirroringissue affects or brought to light from mirroring deployment

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions