Comments (5)
It works for me (on Linux):
$ touch test_0{1,2,3,4,5}.htm
$ ls -la
total 0
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_01.htm
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_02.htm
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_03.htm
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_04.htm
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_05.htm
$ rename -v .htm .html *.htm
`test_01.htm' -> `test_01.html'
`test_02.htm' -> `test_02.html'
`test_03.htm' -> `test_03.html'
`test_04.htm' -> `test_04.html'
`test_05.htm' -> `test_05.html'
$ ls-la
total 0
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_01.html
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_02.html
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_03.html
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_04.html
-rw-r--r-- 1 kzak kzak 0 Jun 3 09:42 test_05.html
from util-linux.
I can reproduce the problem on macOS 12 with util-linux 2.40.1 installed by MacPorts. So can @Bachsau who filed the corresponding MacPorts issue: https://trac.macports.org/ticket/70186
from util-linux.
I confirmed the issue occurs when building master manually outside of MacPorts. I confirmed v2.39.4 does not have the issue when built the same way. I am now running git bisect
to find out when it broke.
from util-linux.
It broke in 7b67193. Reverting this on top of master fixes the problem.
% cat try.sh
#!/bin/sh
dir=$(cd "$(dirname "$0")" && pwd)
./autogen.sh || exit 125
CFLAGS="-Wno-implicit-function-declaration -Wno-int-conversion" ./configure --disable-silent-rules || exit 125
make clean || exit 125
make -j8 rename || exit 125
rm -rf /tmp/test
mkdir /tmp/test || exit 125
cd /tmp/test
touch foo.htm || exit 125
"$dir"/rename -v .htm .html *.htm || exit 125
test -e foo.html
% git bisect start
% git bisect bad master
% git bisect good v2.39.4
% time git bisect run ./try.sh
...
7b67193a53209907f84a6253dcf3aceaf2eb8da1 is the first bad commit
commit 7b67193a53209907f84a6253dcf3aceaf2eb8da1
Author: Thomas Weißschuh <[email protected]>
Date: Tue Dec 5 00:06:59 2023 +0100
rename: properly handle directories with trailing slash
Instead of hand-rolling a basename() function use the standard one which
provides the functionality that we want to use.
Also add a testcase.
Fixes #2569
Signed-off-by: Thomas Weißschuh <[email protected]>
misc-utils/rename.c | 8 ++------
tests/expected/rename/basic | 1 +
tests/ts/rename/basic | 4 ++++
3 files changed, 7 insertions(+), 6 deletions(-)
bisect found first bad commit
git bisect run ./try.sh 452.95s user 266.48s system 87% cpu 13:44.35 total
% git checkout master
% git revert -n 7b67193a53209907f84a6253dcf3aceaf2eb8da1
% ./try.sh; echo $?
...
`foo.htm' -> `foo.html'
0
from util-linux.
I would add that this issue can lead to the loss of files if the --no-overwrite is not being used.
from util-linux.
Related Issues (20)
- Typeo in wipefs.c ("superblok")
- Stop capturing paswords with the log-in flag
- mount with mountfd API cannot remount with relatime or strictatime HOT 1
- Build issue 2.40.1 HOT 2
- 2.40.1 - ld.lld: error: version script assignment of 'UUID_2.40' to symbol 'uuid_time64' failed: symbol not defined
- libblkid doc: missing blkid_probe_get_partitions() error check in partitions API usage example
- command "lscpu -e" hangs/loops when output column width greater than tty column width HOT 2
- Feature request: Shouldn't lscpu output the microcode version of the CPU, too?
- [SECURITY] Memory Leak in fsck.c HOT 1
- libsmartcols/src/filter-xxx.c file causing unnecessary rebuilding and even errors HOT 1
- lscpu: The model name of core in the last cluster is not displayed HOT 10
- Bug: Very confusing error message positioning in fdisk output
- Lack of ability to customize ncurses headers/libraries location for cross-compilation
- wdctl cannot read information about /dev/watchdog HOT 2
- lsblk HOTPLUG does not match /sys/class/block/*/removable HOT 11
- Since libeconf 0.7.1 building util-linux 2.40 or 2.40.1 without --with-vendordir causes segfaults in apps using libblkid HOT 3
- sys-utils/swapoff killed by OOM HOT 2
- Inconsistent behavior for start offset between gpt and dos partition labels
- It is not possible to build just hexdump
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from util-linux.