Dangerous behavior of rm command on recent Linux distributions

Search:

Dangerous behavior of rm command on recent Linux distributions

From: Stan van Gisbergen <vangisbergen_at_email.domain.hidden>
Date: Fri, 13 Sep 2002 10:19:45 +0200
X-Mailer: exmh version 2.0.2 2/24/98

Dear ADF users,

We have a warning for those of you who are running ADF under Redhat 7
(or probably other recent Linux distributions), or who are planning
to do so in the future.

The ADF example scripts currently contain commands like

rm [A-Z]*

in order to remove temporary files that are no longer needed.
The intention is that only files starting with a capital letter,
such as TAPE* are removed. This is indeed the case under
Redhat 6.2 and various regular Unix distributions.

However, the bash kernel (which is invoked via the
#!/bin/sh first line of the examples) under Redhat 7
interprets this such that also the files [a-z]* are removed.

This obviously makes it very dangerous to run such ADF scripts
interactively in directories where user files are present.
We suggest to run such ADF scripts only in a new empty directory
to avoid any such risks.

In addition to this, the ADF scripts will not work, because also
the atomic result files such as t21.C will be removed. The solution
is to set the SHELL variable LC_COLLATE to the value C.

You can check if this helped by checking the output (in the bash shell)
of the command

ls [A-Z]*

in a temporary directory which contains both files starting with a small
letter and files starting with a capital.

We are currently considering alternative ways to handle files in order to
avoid problems similar to this one in the future.

Best regards,
Stan van Gisbergen

------------------------------------------------------------------------
Dr. S.J.A. van Gisbergen SCIENTIFIC COMPUTING & MODELLING NV
Phone: +31-20-4447626 Vrije Universiteit, Theoretical Chemistry
Fax: +31-20-4447629 De Boelelaan 1083
E-mail: vangisbergen_at_scm.com 1081 HV Amsterdam, The Netherlands
                               http://www.scm.com
------------------------------------------------------------------------
Received on 2002-09-13 10:23:40

This archive was generated by hypermail 2.2.0 : 2006-11-02 07:00:02 CET