* [PATCH] rename: change "expression" to "original"
@ 2025-06-21 23:26 Haelwenn (lanodan) Monnier
2025-06-22 9:15 ` Nuno Silva
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Haelwenn (lanodan) Monnier @ 2025-06-21 23:26 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
As rename(1) doesn't uses an expression (like regex or glob) but rather a substring.
---
Note: Not on the mailing-list so CC me on replies
misc-utils/rename.1.adoc | 12 ++++++------
misc-utils/rename.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/misc-utils/rename.1.adoc b/misc-utils/rename.1.adoc
index b8ea2bfdf..e5ba17e7a 100644
--- a/misc-utils/rename.1.adoc
+++ b/misc-utils/rename.1.adoc
@@ -20,11 +20,11 @@ rename - rename files
== SYNOPSIS
-*rename* [options] _expression replacement file_...
+*rename* [options] _original replacement file_...
== DESCRIPTION
-*rename* will rename the specified files by replacing the first occurrence of _expression_ in their name by _replacement_.
+*rename* will rename the specified files by replacing the first occurrence of the _original_ substring in their name by _replacement_.
== OPTIONS
@@ -38,10 +38,10 @@ Show which files were renamed, if any.
Do not make any changes; add *--verbose* to see what would be made.
*-a*, *--all*::
-Replace all occurrences of _expression_ rather than only the first one.
+Replace all occurrences of _original_ rather than only the first one.
*-l*, *--last*::
-Replace the last occurrence of _expression_ rather than the first one.
+Replace the last occurrence of _original_ rather than the first one.
*-o*, *--no-overwrite*::
Do not overwrite existing files. When *--symlink* is active, do not overwrite symlinks pointing to existing targets.
@@ -57,9 +57,9 @@ The renaming has no safeguards by default or without any one of the options *--n
== EDGE CASES
-If the _expression_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
+If the _original_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
-Normally, only the final path component of a filename is updated. (Or with *--symlink*, only the final path component of the link.) But if either _expression_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported.
+Normally, only the final path component of a filename is updated. (Or with *--symlink*, only the final path component of the link.) But if either _original_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported.
== INTERACTIVE MODE
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index bb2e3103d..5eb8f4429 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -251,7 +251,7 @@ static void __attribute__((__noreturn__)) usage(void)
FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
- _(" %s [options] <expression> <replacement> <file>...\n"),
+ _(" %s [options] <original> <replacement> <file>...\n"),
program_invocation_short_name);
fputs(USAGE_SEPARATOR, out);
base-commit: c8e5b8a818323af30ec656f079c7feadaeeb13c3
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] rename: change "expression" to "original"
2025-06-21 23:26 [PATCH] rename: change "expression" to "original" Haelwenn (lanodan) Monnier
@ 2025-06-22 9:15 ` Nuno Silva
2025-06-22 9:49 ` Dirk Gouders
2025-06-22 10:36 ` Dirk Gouders
2025-06-22 15:51 ` Benno Schulenberg
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: Nuno Silva @ 2025-06-22 9:15 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
On 2025-06-22, Haelwenn (lanodan) Monnier wrote:
> As rename(1) doesn't uses an expression (like regex or glob) but
> rather a substring.
[...]
> -*rename* [options] _expression replacement file_...
> +*rename* [options] _original replacement file_...
[...]
Oh. I was aware of there being at least two different "rename" utilities
on Linux systems, this one from util-linux and a perl-based one using
regexes, but I hadn't noticed this wording in the online manual and
usage output.
Yes, this change probably helps telling it apart from the perl-based
rename.
(I don't recall what made confusion more prone in the case of this
utility, was it that some distributions installed the perl one as
"rename"?)
--
Nuno Silva
Who hopes the Cc works properly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rename: change "expression" to "original"
2025-06-22 9:15 ` Nuno Silva
@ 2025-06-22 9:49 ` Dirk Gouders
2025-06-22 10:36 ` Dirk Gouders
1 sibling, 0 replies; 10+ messages in thread
From: Dirk Gouders @ 2025-06-22 9:49 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
Nuno Silva <nunojsilva@ist.utl.pt> writes:
> On 2025-06-22, Haelwenn (lanodan) Monnier wrote:
>
>> As rename(1) doesn't uses an expression (like regex or glob) but
>> rather a substring.
> [...]
>> -*rename* [options] _expression replacement file_...
>> +*rename* [options] _original replacement file_...
> [...]
>
> Oh. I was aware of there being at least two different "rename" utilities
> on Linux systems, this one from util-linux and a perl-based one using
> regexes, but I hadn't noticed this wording in the online manual and
> usage output.
>
> Yes, this change probably helps telling it apart from the perl-based
> rename.
In case this change will be accepted, how about using other terms for
both, "expression / original" and "replacement"? Could be that it is my
individual difficulty but I would way better understand something like:
*rename* [options] _string_1 string_2 file_...
Anyway, I guess the following should be fixed, regardless:
+If the _original_ is empty, then by default _replacement_ will...
=>
+If _original_ is empty, then by default _replacement_ will...
Regards,
Dirk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rename: change "expression" to "original"
2025-06-22 9:15 ` Nuno Silva
2025-06-22 9:49 ` Dirk Gouders
@ 2025-06-22 10:36 ` Dirk Gouders
1 sibling, 0 replies; 10+ messages in thread
From: Dirk Gouders @ 2025-06-22 10:36 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
Resend with Cc address from original posting:
Nuno Silva <nunojsilva@ist.utl.pt> writes:
> On 2025-06-22, Haelwenn (lanodan) Monnier wrote:
>
>> As rename(1) doesn't uses an expression (like regex or glob) but
>> rather a substring.
> [...]
>> -*rename* [options] _expression replacement file_...
>> +*rename* [options] _original replacement file_...
> [...]
>
> Oh. I was aware of there being at least two different "rename" utilities
> on Linux systems, this one from util-linux and a perl-based one using
> regexes, but I hadn't noticed this wording in the online manual and
> usage output.
>
> Yes, this change probably helps telling it apart from the perl-based
> rename.
In case this change will be accepted, how about using other terms for
both, "expression / original" and "replacement"? Could be that it is my
individual difficulty but I would way better understand something like:
*rename* [options] _string_1 string_2 file_...
Anyway, I guess the following should be fixed, regardless:
+If the _original_ is empty, then by default _replacement_ will...
=>
+If _original_ is empty, then by default _replacement_ will...
Regards,
Dirk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rename: change "expression" to "original"
2025-06-21 23:26 [PATCH] rename: change "expression" to "original" Haelwenn (lanodan) Monnier
2025-06-22 9:15 ` Nuno Silva
@ 2025-06-22 15:51 ` Benno Schulenberg
2025-06-30 12:08 ` Karel Zak
[not found] ` <87cyawp26b.fsf@ist.utl.pt>
2025-07-01 16:01 ` [PATCH v2] rename: change "expression" to "substring" Haelwenn (lanodan) Monnier
3 siblings, 1 reply; 10+ messages in thread
From: Benno Schulenberg @ 2025-06-22 15:51 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
[-- Attachment #1.1: Type: text/plain, Size: 713 bytes --]
Op 22-06-2025 om 01:26 schreef Haelwenn (lanodan) Monnier:
> == SYNOPSIS
>
> -*rename* [options] _expression replacement file_...
> +*rename* [options] _original replacement file_...
>
> == DESCRIPTION
>
> -*rename* will rename the specified files by replacing the first occurrence of _expression_ in their name by _replacement_.
> +*rename* will rename the specified files by replacing the first occurrence of the _original_ substring in their name by _replacement_.
Instead of using the word "original" (where I would first think: original
what?), why not use "substring"? It describes what the thing actually is,
and fits better in the rest of the existing wording.
Benno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rename: change "expression" to "original"
2025-06-22 15:51 ` Benno Schulenberg
@ 2025-06-30 12:08 ` Karel Zak
2025-07-01 16:03 ` Haelwenn (lanodan) Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Karel Zak @ 2025-06-30 12:08 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux, Haelwenn (lanodan) Monnier
On Sun, Jun 22, 2025 at 05:51:39PM +0200, Benno Schulenberg wrote:
>
> Op 22-06-2025 om 01:26 schreef Haelwenn (lanodan) Monnier:
> > == SYNOPSIS
> > -*rename* [options] _expression replacement file_...
> > +*rename* [options] _original replacement file_...
Yes, the current situation ("expression") is unreadable.
> > == DESCRIPTION
> > -*rename* will rename the specified files by replacing the first occurrence of _expression_ in their name by _replacement_.
> > +*rename* will rename the specified files by replacing the first occurrence of the _original_ substring in their name by _replacement_.
>
> Instead of using the word "original" (where I would first think: original
> what?), why not use "substring"? It describes what the thing actually is,
> and fits better in the rest of the existing wording.
It seems that in documentation for replace-like functions, it's common
to use "substring", sometimes the function itself uses "substring" in its name
(e.g., awk gsub()).
Haelwenn, do you want to update the patch?
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] rename: change "expression" to "original"
2025-06-30 12:08 ` Karel Zak
@ 2025-07-01 16:03 ` Haelwenn (lanodan) Monnier
0 siblings, 0 replies; 10+ messages in thread
From: Haelwenn (lanodan) Monnier @ 2025-07-01 16:03 UTC (permalink / raw)
To: Karel Zak; +Cc: Benno Schulenberg, util-linux
[2025-06-30 14:08:01+0200] Karel Zak:
>On Sun, Jun 22, 2025 at 05:51:39PM +0200, Benno Schulenberg wrote:
>>
>> Op 22-06-2025 om 01:26 schreef Haelwenn (lanodan) Monnier:
>> > == SYNOPSIS
>> > -*rename* [options] _expression replacement file_...
>> > +*rename* [options] _original replacement file_...
>
>Yes, the current situation ("expression") is unreadable.
>
>> > == DESCRIPTION
>> > -*rename* will rename the specified files by replacing the first occurrence of _expression_ in their name by _replacement_.
>> > +*rename* will rename the specified files by replacing the first occurrence of the _original_ substring in their name by _replacement_.
>>
>> Instead of using the word "original" (where I would first think: original
>> what?), why not use "substring"? It describes what the thing actually is,
>> and fits better in the rest of the existing wording.
>
>It seems that in documentation for replace-like functions, it's common
>to use "substring", sometimes the function itself uses "substring" in its name
>(e.g., awk gsub()).
>
>Haelwenn, do you want to update the patch?
>
> Karel
Yeah, sent a V2, wanted to wait a bit in case there were additional feedback
Best regards
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <87cyawp26b.fsf@ist.utl.pt>]
* Re: [PATCH] rename: change "expression" to "original"
[not found] ` <87cyawp26b.fsf@ist.utl.pt>
@ 2025-06-22 21:34 ` Haelwenn (lanodan) Monnier
0 siblings, 0 replies; 10+ messages in thread
From: Haelwenn (lanodan) Monnier @ 2025-06-22 21:34 UTC (permalink / raw)
To: Nuno Silva; +Cc: util-linux
[2025-06-22 10:23:12+0100] Nuno Silva:
>(Resending via mail only because the mailing list post with Cc hit an
>issue with Gmane, but was successfully delivered to the list.)
Ack, CC'd back the mailing-list so trail isn't lost
>On 2025-06-22, Haelwenn (lanodan) Monnier wrote:
>
>> As rename(1) doesn't uses an expression (like regex or glob) but
>> rather a substring.
>[...]
>> -*rename* [options] _expression replacement file_...
>> +*rename* [options] _original replacement file_...
>[...]
>
>Oh. I was aware of there being at least two different "rename" utilities
>on Linux systems, this one from util-linux and a perl-based one using
>regexes, but I hadn't noticed this wording in the online manual and
>usage output.
>
>Yes, this change probably helps telling it apart from the perl-based
>rename.
>
>(I don't recall what made confusion more prone in the case of this
>utility, was it that some distributions installed the perl one as
>"rename"?)
I know FreeBSD rename(1) is the perl one, and it seems like Debian
changed perl rename from `rename` to `file-rename` in bookworm:
Before: https://packages.debian.org/bullseye/rename
After: https://packages.debian.org/bookworm/rename
And has util-linux rename as `rename.ul`: https://packages.debian.org/bookworm/amd64/util-linux/filelist
Best regards
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] rename: change "expression" to "substring"
2025-06-21 23:26 [PATCH] rename: change "expression" to "original" Haelwenn (lanodan) Monnier
` (2 preceding siblings ...)
[not found] ` <87cyawp26b.fsf@ist.utl.pt>
@ 2025-07-01 16:01 ` Haelwenn (lanodan) Monnier
2025-07-02 8:03 ` Karel Zak
3 siblings, 1 reply; 10+ messages in thread
From: Haelwenn (lanodan) Monnier @ 2025-07-01 16:01 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
As rename(1) doesn't uses an expression (like regex or glob) but rather a substring.
---
misc-utils/rename.1.adoc | 12 ++++++------
misc-utils/rename.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/misc-utils/rename.1.adoc b/misc-utils/rename.1.adoc
index b8ea2bfdf..fc7df4f1c 100644
--- a/misc-utils/rename.1.adoc
+++ b/misc-utils/rename.1.adoc
@@ -20,11 +20,11 @@ rename - rename files
== SYNOPSIS
-*rename* [options] _expression replacement file_...
+*rename* [options] _substring replacement file_...
== DESCRIPTION
-*rename* will rename the specified files by replacing the first occurrence of _expression_ in their name by _replacement_.
+*rename* will rename the specified files by replacing the first occurrence of _substring_ in their name by _replacement_.
== OPTIONS
@@ -38,10 +38,10 @@ Show which files were renamed, if any.
Do not make any changes; add *--verbose* to see what would be made.
*-a*, *--all*::
-Replace all occurrences of _expression_ rather than only the first one.
+Replace all occurrences of _substring_ rather than only the first one.
*-l*, *--last*::
-Replace the last occurrence of _expression_ rather than the first one.
+Replace the last occurrence of _substring_ rather than the first one.
*-o*, *--no-overwrite*::
Do not overwrite existing files. When *--symlink* is active, do not overwrite symlinks pointing to existing targets.
@@ -57,9 +57,9 @@ The renaming has no safeguards by default or without any one of the options *--n
== EDGE CASES
-If the _expression_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
+If _substring_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
-Normally, only the final path component of a filename is updated. (Or with *--symlink*, only the final path component of the link.) But if either _expression_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported.
+Normally, only the final path component of a filename is updated. (Or with *--symlink*, only the final path component of the link.) But if either _substring_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported.
== INTERACTIVE MODE
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index bb2e3103d..d7bf4c5d7 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -251,7 +251,7 @@ static void __attribute__((__noreturn__)) usage(void)
FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
- _(" %s [options] <expression> <replacement> <file>...\n"),
+ _(" %s [options] <substring> <replacement> <file>...\n"),
program_invocation_short_name);
fputs(USAGE_SEPARATOR, out);
base-commit: c8e5b8a818323af30ec656f079c7feadaeeb13c3
--
2.49.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-07-02 8:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-21 23:26 [PATCH] rename: change "expression" to "original" Haelwenn (lanodan) Monnier
2025-06-22 9:15 ` Nuno Silva
2025-06-22 9:49 ` Dirk Gouders
2025-06-22 10:36 ` Dirk Gouders
2025-06-22 15:51 ` Benno Schulenberg
2025-06-30 12:08 ` Karel Zak
2025-07-01 16:03 ` Haelwenn (lanodan) Monnier
[not found] ` <87cyawp26b.fsf@ist.utl.pt>
2025-06-22 21:34 ` Haelwenn (lanodan) Monnier
2025-07-01 16:01 ` [PATCH v2] rename: change "expression" to "substring" Haelwenn (lanodan) Monnier
2025-07-02 8:03 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).