Coder Social home page Coder Social logo

Comments (5)

karelzak avatar karelzak commented on June 27, 2024 1

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.

ryandesign avatar ryandesign commented on June 27, 2024 1

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.

ryandesign avatar ryandesign commented on June 27, 2024 1

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.

ryandesign avatar ryandesign commented on June 27, 2024

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.

FaradayLight avatar FaradayLight commented on June 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.