Re: Tip of the day. Don't clobber your files.

2005-10-23 Thread Michael JasonSmith
On Thu, 2005-10-20 at 21:05 +1300, Isaac Devine wrote:
> Did you have a look at darcs? (www.darcs.net) It's fanastic!

Heard of it, have not used it ☺

-- 
Michael JasonSmithhttp://ldots.org/



Re: Tip of the day. Don't clobber your files.

2005-10-20 Thread Isaac Devine
On 10/14/05, Michael JasonSmith <[EMAIL PROTECTED]> wrote:
> On Fri, 2005-10-14 at 12:16 +1300, Glynn Foster wrote:
> > Dunno about that - baz-ng is looking pretty interesting.
> >
> >  http://www.bazaar-ng.org/
> >
> > Obviously very early stages of development though.
>
> I was evaluating the systems to determine which should be used by the
> third-year students, so the criteria included good documentation,
> stability, and the ability to work with firewalls. While Bazaar looks
> really nice, it may need to mature a bit :)
>
> --
> Michael JasonSmithhttp://ldots.org/
>
>

Did you have a look at darcs? (www.darcs.net) It's fanastic!

Isaac


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Michael JasonSmith
On Fri, 2005-10-14 at 12:16 +1300, Glynn Foster wrote:
> Dunno about that - baz-ng is looking pretty interesting.
> 
>  http://www.bazaar-ng.org/
> 
> Obviously very early stages of development though.

I was evaluating the systems to determine which should be used by the
third-year students, so the criteria included good documentation,
stability, and the ability to work with firewalls. While Bazaar looks
really nice, it may need to mature a bit :)

-- 
Michael JasonSmithhttp://ldots.org/



Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Glynn Foster
Hey,

On Fri, 2005-10-14 at 11:48 +1300, Michael JasonSmith wrote:
> On Fri, 2005-10-14 at 11:32 +1300, Hadley Rich wrote:
> > Subversion to rule them all.
> 
> I looked at a number of free version-control systems early this year and
> came to the conclusion that Subversion was the best of the commonly
> available (free) systems.

Dunno about that - baz-ng is looking pretty interesting.

 http://www.bazaar-ng.org/

Obviously very early stages of development though.


Glynn



Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Michael JasonSmith
On Fri, 2005-10-14 at 11:32 +1300, Hadley Rich wrote:
> Subversion to rule them all.

I looked at a number of free version-control systems early this year and
came to the conclusion that Subversion was the best of the commonly
available (free) systems.

-- 
Michael JasonSmithhttp://ldots.org/



Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Hadley Rich
On Friday 14 October 2005 11:29, Christopher Sawtell wrote:
> On Friday 14 October 2005 11:18, Carl Cerecke wrote:
> > On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:
> > > On Thursday 13 October 2005 19:37, Derek Smithies wrote:
> > > > Hi,
> > > >
> > > > On Thu, 13 Oct 2005, Carl Cerecke wrote:
> > > > > Second Moral: Backups or version control systems are a Good Idea.
> > >
> > > Which one do you recommend?
> >
> > In most cases, both :-)
>
> Indeed, I was meaning which version control system?

Subversion to rule them all.

hads

-- 
LSD melts in your mind, not in your hand.


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Christopher Sawtell
On Friday 14 October 2005 11:18, Carl Cerecke wrote:
> On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:
> > On Thursday 13 October 2005 19:37, Derek Smithies wrote:
> > > Hi,
> > >
> > > On Thu, 13 Oct 2005, Carl Cerecke wrote:
> > > > Second Moral: Backups or version control systems are a Good Idea.
> >
> > Which one do you recommend?
>
> In most cases, both :-)
Indeed, I was meaning which version control system?

-- 
CS


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Carl Cerecke
On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:
> On Thursday 13 October 2005 19:37, Derek Smithies wrote:
> > Hi,
> >
> > On Thu, 13 Oct 2005, Carl Cerecke wrote:
> > > Second Moral: Backups or version control systems are a Good Idea.
> Which one do you recommend?

In most cases, both :-)


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Christopher Sawtell
On Friday 14 October 2005 10:56, Robert Himmelmann wrote:
> pdumpfs. It uses hardlinks for multiple backups.
Hey, that looks really good. Many thanks!
-- 
CS


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Robert Himmelmann

Christopher Sawtell wrote:


On Thursday 13 October 2005 19:37, Derek Smithies wrote:
 


Hi,

On Thu, 13 Oct 2005, Carl Cerecke wrote:
   


Second Moral: Backups or version control systems are a Good Idea.
 


Which one do you recommend?
 


pdumpfs. It uses hardlinks for multiple backups.

pdumpfs --exclude=music /home/robert/ /data/backup/home/ 
>/data/backup/home/log 2>/data/backup/home/error-log


Happy Hacking,
Robert Himmelmann


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Christopher Sawtell
On Friday 14 October 2005 09:00, Steve Holdoway wrote:
> On Fri, October 14, 2005 7:36 am, Carl Cerecke wrote:
> > On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:
> >> 
> >> putting an empty file named -i in a directory will save your sanity, and
> >> the
> >> possible amputation of your rh thumb, if you, by mistake, issue the
> >> command
> >> rm * .o
> >> ^
> >> note the erroneous space
> >> 
> >
> > Trouble is, every other command on the command line that has a * gets
> > a -i option sent to it as well. Also, is the shell guranteed to put
> > the -i at the start of a glob expansion? I know different locales have
> > different ordering (some are case-insensitive).
> >
> > Cheers,
> > Carl.
>
> Alternalively, for a more global solution, add the following to your
> /etc/profile ( or ~/.bash_profile for a more local solution )...
>
> alias cp='cp -i'
> alias mv='mv -i'
> alias rm='rm -i'
>
> and your sanity will be preserved. Well, actually, I find it gets annoying
> after a while,
I do too, so much so that I find that particular trick to be guaranteed to 
induce instant insanity. I loath and detest distributors who secretively 
change the documented behaviour of unix utilities. Thus the reason for my 
enthusiasm for the geriatric unix hacker's trick which I learnt off usenet 
more years ago that I wish to remember.

> and end up using the -f flag instead, but then I'm stupid. 


-- 
CS


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Steve Holdoway

On Fri, October 14, 2005 7:36 am, Carl Cerecke wrote:
> On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:
>
>> 
>> putting an empty file named -i in a directory will save your sanity, and
>> the
>> possible amputation of your rh thumb, if you, by mistake, issue the
>> command
>> rm * .o
>> ^
>> note the erroneous space
>> 
>
> Trouble is, every other command on the command line that has a * gets
> a -i option sent to it as well. Also, is the shell guranteed to put
> the -i at the start of a glob expansion? I know different locales have
> different ordering (some are case-insensitive).
>
> Cheers,
> Carl.
>
>
Alternalively, for a more global solution, add the following to your
/etc/profile ( or ~/.bash_profile for a more local solution )...

alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'

and your sanity will be preserved. Well, actually, I find it gets annoying
after a while, and end up using the -f flag instead, but then I'm stupid.

$0.02,

Steve


-- 
Work like you don't need the money,
Love like your heart has never been broken and
Dance like no one can see you.


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Christopher Sawtell
On Friday 14 October 2005 07:36, Carl Cerecke wrote:
> On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:
> > 
> > putting an empty file named -i in a directory will save your sanity, and
> > the possible amputation of your rh thumb, if you, by mistake, issue the
> > command rm * .o
> > ^
> > note the erroneous space
> > 
>
> Trouble is, every other command on the command line that has a * gets
> a -i option sent to it as well.
True, but I have yet to have any which have been upset by that, but I'm not 
using the command line unix utilities anything like as much as I used to.
Have you had problems?

> Also, is the shell guranteed to put 
> the -i at the start of a glob expansion?
Probably not _guaranteed_ to, but I have yet to see it do any different in 
practice.

Of course, the best way of implementing this would be to modify the rm utility 
so that it responded to the presence of a .keep file in the directory to add 
the functionality of the -i flag.

> I know different locales have 
> different ordering (some are case-insensitive).

-- 
CS


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Carl Cerecke
On 13/10/05, Christopher Sawtell <[EMAIL PROTECTED]> wrote:

> 
> putting an empty file named -i in a directory will save your sanity, and the
> possible amputation of your rh thumb, if you, by mistake, issue the command
> rm * .o
> ^
> note the erroneous space
> 

Trouble is, every other command on the command line that has a * gets
a -i option sent to it as well. Also, is the shell guranteed to put
the -i at the start of a glob expansion? I know different locales have
different ordering (some are case-insensitive).

Cheers,
Carl.


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread David Mann

On Oct 13, 2005, at 7:37 PM, Derek Smithies wrote:


yes,
I know of one commercial linux provider who has his entire /etc  
directory

in CVS.


Not a bad idea.  I tend to use CDR myself but I don't update anything  
in /etc very often.


On the day I accidentally typed:
rm -rf /etc/*

when I meant:
rm -rf /mnt/etc/*

I was saved by two factors:
1) my server was short of memory which made it quite slow, so it'd  
only removed a handful of files by the time I hit ^C,
2) I had another Linux machine handy that I could use to compare  
directories and copy files from.


For my real work I'm using Subversion.  Compared to my old revision  
control system, which consisted of numbered .zip files and a  
changelog, it's absolute bliss.


- Dave



Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Ross Drummond

Excellent idea Chris. I use this myself to protect important files from 
accidental deletion. However using the command;

touch -i

to create a file named -i creates an error. This is easily solved by using the 
double minus option. This tells the shell to interpret anything following as 
an argument even though it looks like an option. Thus the command;

touch -- -i

will create a zero length file named -i without error.

Hint view this text with a fixed width font, variable width fonts run the 
double minuses together making them appear as one.


On Thu, 13 Oct 2005 20:32, Christopher Sawtell wrote:
> 
> putting an empty file named -i in a directory will save your sanity, and
> the possible amputation of your rh thumb, if you, by mistake, issue the
> command rm * .o
> ^
> note the erroneous space
> 


Re: Tip of the day. Don't clobber your files.

2005-10-13 Thread Christopher Sawtell
On Thursday 13 October 2005 19:37, Derek Smithies wrote:
> Hi,
>
> On Thu, 13 Oct 2005, Carl Cerecke wrote:
> > Second Moral: Backups or version control systems are a Good Idea.
Which one do you recommend?

> yes,
> I know of one commercial linux provider who has his entire /etc directory
> in CVS.


putting an empty file named -i in a directory will save your sanity, and the 
possible amputation of your rh thumb, if you, by mistake, issue the command 
rm * .o 
^
note the erroneous space


-- 
CS


Re: Tip of the day. Don't clobber your files.

2005-10-12 Thread Derek Smithies
Hi,

On Thu, 13 Oct 2005, Carl Cerecke wrote:
> 
> Second Moral: Backups or version control systems are a Good Idea.
> 
yes, 
I know of one commercial linux provider who has his entire /etc directory 
in CVS.

=
One of those laws:
 there are two times when you can test the quality of your backup systems.
  a)before disaster happens
  b)after disaster happens.

Derek.


-- 
Derek Smithies Ph.D. Any fool can write code that 
IndraNet Technologies Ltd.a computer can understand.
Email: [EMAIL PROTECTED] Good programmers write code 
ph +64 3 365 6485  that humans can understand.
Web: http://www.indranet-technologies.com/Martin Fowler



Tip of the day. Don't clobber your files.

2005-10-12 Thread Carl Cerecke
Had a bunch of python scripts in a directory.

They all needed some munging. It was too complicated for my sed
skills, so I wrote a python script to munge the python scripts.

Here's how I ran it:

for f in UC*.py; do cp $f $f.orig; ./munge $f.orig > $f; echo $f; done

Only problem was, the script was called munge.py, not munge, so I got
a whole bunch of:

bash: ./munge: No such file or directory

Oops. up-arrow twice to previous command and change to ./munge.py:

for f in UC*.py; do cp $f $f.orig; ./munge.py $f.orig > $f; echo $f; done

Just about to hit return, when I decided to quickly check the directory listing.

Yep. Every file matching UC*.py was of zero length. If I had run the
correct version, It would have copied the zero-length version over the
$f.orig version, and all would have been lost! Except, of course, the
files are in a version control system, so all would not have been
lost.

Moral of the story: The shell interprets shell redirects, not the
program. Even if the program fails, the redirect (such as > foo) will
create a zero-length foo, clobbering any existing foo. I think you can
turn off this useful feature with a noclobber option in the shell.

Second Moral: Backups or version control systems are a Good Idea.

Cheers,
Carl.