GNU bug report logs -
#52410
"mv -T --backup=numbered hello world/" renameat2 infinite loop
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
If DEST directory has a trailing slash in "mv -T --backup=numbered", mv
gets stuck in an infinite loop. This does not happen without the trailing
slash. strace shows renameat2 as the call that gets looped on. This is
tested on coreutils 8.30 Ubuntu 20.04.
Example:
```
mkdir hello hello1 world/
mv -T --backup=numbered hello world/
strace mv -T --backup=numbered hello1 world/ 2>&1 | less
```
less output at infinite loop:
```
renameat2(AT_FDCWD, "world/", 3, "world.~1~", RENAME_NOREPLACE) = -1 EEXIST
(File exists)
lseek(3, 0, SEEK_SET) = 0
getdents64(3, /* 39 entries */, 32768) = 1240
getdents64(3, /* 0 entries */, 32768) = 0
renameat2(AT_FDCWD, "world/", 3, "world/", RENAME_NOREPLACE) = -1 EEXIST
(File exists)
lseek(3, 0, SEEK_SET) = 0
getdents64(3, /* 39 entries */, 32768) = 1240
getdents64(3, /* 0 entries */, 32768) = 0
renameat2(AT_FDCWD, "world/", 3, "world/", RENAME_NOREPLACE) = -1 EEXIST
(File exists)
lseek(3, 0, SEEK_SET) = 0
getdents64(3, /* 39 entries */, 32768) = 1240
getdents64(3, /* 0 entries */, 32768) = 0
```
[Message part 2 (text/html, inline)]
This bug report was last modified 3 years and 172 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.