Opened 5 months ago

Closed 4 months ago

Last modified 4 months ago

#70186 closed defect (fixed)

util-linux @2.40.1: `rename` doesn't preserve original file name parts

Reported by: Bachsau (Bachsau) Owned by: kurthindenburg (Kurt Hindenburg)
Priority: High Milestone:
Component: ports Version: 2.9.3
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: util-linux

Description

I've been running the following command and instead of replacing the file extension, it wants to rename every file to the exact string specified as the replacement:

find . -type f -iname '*.pdf' -exec rename -v -n pdf pdf_ {} +

Running the same command in the same directory from a linux machine works as expected.

For example, it does this:

'./2020/2020-01.pdf' -> `pdf_'

instead of this:

'./2020/2020-01.pdf' -> `./2020/2020-01.pdf_'

Change History (4)

comment:1 Changed 5 months ago by Bachsau (Bachsau)

It actually is version 2.40.1, but that isn't selectable.

comment:2 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to kurthindenburg
Status: newassigned
Summary: `rename` doesn't preserve original file name partsutil-linux @2.40.1: `rename` doesn't preserve original file name parts

The selectable version in the issue template is the MacPorts version, not the port version (which goes in the summary along with the port name).

Just to make sure, I tried an example from the rename manpage:

rename .htm .html *.htm

will fix the extension of your html files.

% port -v installed util-linux
The following ports are currently installed:
  util-linux @2.40.1_0 (active) requested_variants='' platform='darwin 21' archs='x86_64' date='2024-05-15T02:37:30-0500'
% mkdir test
% cd test
% touch foo.htm bar.htm
% ls -la
total 0
drwxr-xr-x   4 rschmidt  wheel   128 Jun  7 14:39 .
drwxrwxrwt  42 root      wheel  1344 Jun  7 14:38 ..
-rw-r--r--   1 rschmidt  wheel     0 Jun  7 14:39 bar.htm
-rw-r--r--   1 rschmidt  wheel     0 Jun  7 14:39 foo.htm
% rename -v .htm .html *.htm 
`bar.htm' -> `.html'
`foo.htm' -> `.html'
% ls -la
total 0
drwxr-xr-x   3 rschmidt  wheel    96 Jun  7 14:39 .
drwxrwxrwt  42 root      wheel  1344 Jun  7 14:38 ..
-rw-r--r--   1 rschmidt  wheel     0 Jun  7 14:39 .html
%

Here is the upstream issue: https://github.com/util-linux/util-linux/issues/3071

comment:3 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

In baf43ea76b241b71522cce544a8918d89cb76c17/macports-ports (master):

util-linux: Fix rename command

Closes: #70186

comment:4 Changed 4 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign added
Note: See TracTickets for help on using tickets.