Subject: bug#15168: mkdir alway creates a file instead a direktory if it is run trough a sub sub shell

From: Bob Proulx <[email-masked]>
Date: Sat, 24 Aug 2013 12:46:32 -0600

horvan dillus wrote:
> For a better ovvervie  I'll post the  4 scripts I mentioned above:

Wow.  That is really quite a complicated report.  It will take a lot
of work to crack into it.  If you can't simplify it then I doubt
anyone will have enough time to do so for you.  It is too big.  It is
completely dependent upon your environment.  Please reduce this to
something that another person could reproduce.

I do have one question from the inspection of the scripts.  Try making
this change that I describe below.

> and here is the last script where mkdir is present
> 
> #!/bin/bash
> DLURL=https://drubuntu.googlecode.com/git
> #settiing up drush
> drush -y dl drush --destination=/usr/share;
> #Download and set up drupal
> *
> *
> *mkdir /var/www/d7*
> ...
>  The result of the mkdir line I've marked creates a file in var/www that is
> called d7 so the rest of the script fails.

First, those "*" characters, what are they?  Two are on a line by
itself.  You said you marked a line.  I think you confused things
terribly when you did that.  Because "*" is special to the shell.  It
is a file glob.  The shell expands it to match a glob of characters.
This makes it data dependent.  When you have lines with only a "*" in
the script on that line then what happens depends upon what files are
in the current directory.

Remove those star characters.  Those are definitely bad.  Fix that
first.  I can't stress this enough.  Those are bad.  Remove them.

  -*
  -*
  -*mkdir /var/www/d7*
  +mkdir /var/www/d7

Then on the line before the mkdir add a line that lists the file you
are trying to make.  This is a brute force print debug technique.  But
it may be the best for you.

  echo ================ before mkdir
  ls -ld /var/www/d7
  mkdir /var/www/d7
  ls -ld /var/www/d7
  echo ================ after mkdir

> There are more scripts of course I hope this will be enough information to
> exermain if this is really a bug.

I expect you will find that mkdir is making directories.  If you are
seeing it to be a file then I expect you will find that it was already
a file before the mkdir.  I expect that ls command will show that
there was a file present and then the mkdir fails.

Bob