Skip to main content.
home | support | download

Back to List Archive

found problem 'mv' command (was: unexpected (and bad) results

From: SRE <eckert(at)>
Date: Thu Sep 19 2002 - 04:14:51 GMT
At 06:11 PM 9/18/02, SRE wrote:
>config.status: creating Makefile
>mv: Makefile: set owner/group (was: 35/0): Operation not permitted

As I mentioned before, this problem doesn't occur on Solaris 2.6,
but does occur on FreeBSD (both 2.2.7 and 4.6.2). I'm using the
older OS to debug because I have command line access...

It turns out (with the help of some debugging 'echo' statements)
that the offending line in "configure" is this one:
    mv $tmp/out $ac_file

If I'm reading the script correctly, a "secure" temporary
directory was created, and a file called "out" was created
there, then that file gets moved ACROSS FILE SYSTEMS to the
local directory. You shouldn't use "mv" for that. You should
use "cat" and "rm". Things created in /tmp tend to be owned
by your username but in some other group. Like "bin".

I wrapped the offending line in some debug statements:
  echo DEBUG ready to move $tmp/out to $ac_file
  ls -l $tmp/out $ac_file
    mv $tmp/out $ac_file
  echo DEBUG done moving
  ls -l $tmp/out $ac_file

Here's the output:
  config.status: creating Makefile
  DEBUG ready to move /tmp/csg27209/out to Makefile
  ls: Makefile: No such file or directory
  -rw-r--r--  1 eckert  bin  2315 Sep 18 20:45 /tmp/csg27209/out
  mv: Makefile: set owner/group (was: 1002/7): Operation not permitted
  DEBUG done moving
  ls: /tmp/csg27209/out: No such file or directory
  -rw-r--r--  1 eckert  eckert  2315 Sep 18 20:45 Makefile

You can see that the file gets moved, the userid remains the
same, but the groupid gets changed... that's where the error
is coming from. This can be avoided by rewriting
    mv $tmp/out $ac_file
    cat $tmp/out > $ac_file
    rm $tmp/out
which I tested and which works perfectly.

Actually, that's the way it's done in the OTHER half of the
"if" statement that contains the offending "mv" command, but
"rm -f" is used and I'm not clear why.

So, hopefully one of the authors can update the release with
this change and the more important "test" change, and we'll
be done with these pesky transcript warnings from configure.
Hope this helped. Now, on to the next step...

Received on Thu Sep 19 04:18:31 2002