Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] rename: allow full-path renames
@ 2015-06-22 16:23 Andreas Henriksson
  2015-06-22 17:08 ` Sami Kerola
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Henriksson @ 2015-06-22 16:23 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson, Andreas Henriksson

From: Andreas Henriksson <andreas.henriksson@endian.se>

The command "touch b0;rename.ul -v ./b0 ./b1 ./b0" used to work
before "allow renaming in subdirectories" change.
(regression in commit bd9ced628bb86)

Addresses: https://bugs.debian.org/789240
Reported-by: gregrwm <bug-grub@whitleymott.net>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 misc-utils/rename.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 7ac068d..c8a4f8c 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -92,10 +92,11 @@ static int do_symlink(char *from, char *to, char *s, int verbose)
 
 static int do_file(char *from, char *to, char *s, int verbose)
 {
-	char *newname = NULL, *file;
+	char *newname = NULL, *file=NULL;
 	int ret = 1;
 
-	file = strrchr(s, '/');
+	if (strchr(from, '/') == NULL && strchr(to, '/') == NULL)
+		file = strrchr(s, '/');
 	if (file == NULL)
 		file = s;
 	if (string_replace(from, to, file, s, &newname))
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-25 10:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-22 16:23 [PATCH] rename: allow full-path renames Andreas Henriksson
2015-06-22 17:08 ` Sami Kerola
2015-06-22 17:22   ` [PATCH] tests: add fullpath tests to rename/subdir Andreas Henriksson
2015-06-25 10:03     ` Karel Zak
2015-06-22 17:26   ` [PATCH v2] rename: allow full-path renames Andreas Henriksson
2015-06-25 10:04     ` Karel Zak
2015-06-22 17:29   ` [PATCH] " Andreas Henriksson
2015-06-25 10:06   ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox