dbTalk Databases Forums  

[BUGS] rm -rf in initlocation violates Rule of Least Surprise

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] rm -rf in initlocation violates Rule of Least Surprise in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Clifford T. Matthews
 
Posts: n/a

Default [BUGS] rm -rf in initlocation violates Rule of Least Surprise - 10-25-2003 , 12:36 PM






Using initlocation from postgresql 7.3.4 I managed to blow away some
important data tonight due to "exit_nicely"'s "rm -rf". Specifically
the system where I have postgresql installed on has a small /usr
partition, so the default location for databases is insufficient to
host one of the databases I need to load. After reading the man page
for createdb and initlocation I ran initlocation on the base of a
larger filesystem, e.g.

initlocation -D /slm/big

I didn't actually own that directory, so initlocation couldn't chmod
go-rwx it. Unbeknownst to me, initlocation proceeded to rm -rf that
directory. The directory remained, but since I had group write
permission on the directory, some files that I didn't own (that I
didn't even know were there) got killed. Nothing in the documentation
I read hinted that such a thing was going to happen.

If it's likely to be accepted, I'll make these changes to initlocation
and submit a patch:

by default, check to see that the user who is running is the owner
of the normal PGDATA directory, rather than check to see that he's
not root

In the case of failure, only delete and undo the things that
initlocation has already done

I don't read the pgsql-bugs mailing list, so you'll need to cc me (or
e-mail me off the list) to let me know that such a patch is likely to
be accepted.

Best regards,

Cliff Matthews <ctm (AT) ardi (DOT) com>

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly

Reply With Quote
  #2  
Old   
Neil Conway
 
Posts: n/a

Default Re: [BUGS] rm -rf in initlocation violates Rule of Least Surprise - 11-04-2003 , 01:46 AM






On Fri, 2003-10-24 at 22:59, Clifford T. Matthews wrote:
Quote:
Using initlocation from postgresql 7.3.4 I managed to blow away some
important data tonight due to "exit_nicely"'s "rm -rf".
Has there been any followup on this? IMHO this is a bug we should fix.

-Neil



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] rm -rf in initlocation violates Rule of Least Surprise - 11-04-2003 , 09:34 AM



Neil Conway <neilc (AT) samurai (DOT) com> writes:
Quote:
On Fri, 2003-10-24 at 22:59, Clifford T. Matthews wrote:
Using initlocation from postgresql 7.3.4 I managed to blow away some
important data tonight due to "exit_nicely"'s "rm -rf".

Has there been any followup on this? IMHO this is a bug we should fix.
I'm disinclined to expend any effort at all on initlocation, since it's
going to disappear when we have tablespaces ... which I would like to
believe will happen for 7.5.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.