bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I think I found a bug in the mv command


From: Ian MacGregor
Subject: I think I found a bug in the mv command
Date: Fri, 4 Feb 2005 07:13:35 -0800
User-agent: KMail/1.7.1

I think I found a bug in the mv command.
Here's the scenario:

I have the following in a bash script that is run as a root cronjob:

--- begin bash script code, contents of myuserbackup.sh ---
#!/bin/bash

# this bash script is intended to be run as a cronjob for root
# line 1 - backup the entire /home/ianmac directory to 
the /home/storage/backup.tar.gz file
# line 2 - change user and group ownerships of the backup to ianmac
# line 3 - add the date and time to the backup filename
tar -czf /home/storage/backup.tar.gz /home/ianmac
chown ianmac.ianmac /home/storage/backup.tar.gz
mv /home/storage/backup.tar.gz /home/storage/`date +%Y%m%d-%k%M`-backup.tar.gz
--- end bash script code, contents of myuserbackup.sh ---
When I run this script as a root cronjob, it takes all of the CPU resources 
and never stops.

When I run this command manually I get the following output:

--- begin output in konsole ---
address@hidden bin]# ./myuserbackup.sh
tar: Removing leading `/' from member names
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
address@hidden bin]#
--- end output in konsole ---
The mv command portion will not finish (adding the date and time to the 
filename).

When I change line #9 in the bash script from 
mv /home/storage/backup.tar.gz /home/storage/`date +%Y%m%d-%k%M`-backup.tar.gz
to
mv /home/storage/backup.tar.gz /home/storage/`date +%Y%m%d-%I%M`-backup.tar.gz
the command runs fine and the only output is below, and as a cronjob, it runs 
and finishes fine:
--- begin output ---
address@hidden bin]# ./myuserbackup.sh
tar: Removing leading `/' from member names
address@hidden bin]#
--- end output ---

The change in the mv command line is that I wanted the date (date 
+%Y%m%d-%k%M) to show 24 hour time instead of 12 hour time (date 
+%Y%m%d-%I%M), I changed the "k" to "I". I wanted to do this so that backups 
made at 6pm would show as 1800 instead of 0600. But, when I try this, I get 
the above output.

My computer specs:
AMD Athlon XP 3000+, 160Gb HD, 512Mb ram
I am running Fedora Core 3 as my OS and Window Maker 0.91.0 as my window 
manager.

The output of uname -a is:
address@hidden bin]# uname -a
Linux localhost.localdomain 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004 i686 
athlon i386 GNU/Linux
address@hidden bin]#

The version of mv that I am using:
address@hidden bin]# mv --version
mv (coreutils) 5.2.1
Written by Mike Parker, David MacKenzie, and Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
address@hidden bin]#

Did I find a bug in the mv command? Or, am I doing it wrong?
Let me know if you need any more information and I will be glad to help.

Regards,
greatscot (aka Ian MacGregor)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]