GNU bug report logs -
#15168
mkdir alway creates a file instead a direktory if it is run trough a sub sub shell
Previous Next
Reported by: horvan dillus <horvandillus <at> gmail.com>
Date: Fri, 23 Aug 2013 17:31:01 UTC
Severity: normal
Tags: moreinfo
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15168 in the body.
You can then email your comments to 15168 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#15168
; Package
coreutils
.
(Fri, 23 Aug 2013 17:31:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
horvan dillus <horvandillus <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 23 Aug 2013 17:31:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
three scripts here
first one getit.sh to get some scripts with wget
second one install.sh to run the scripts and set up some things with bash
third one the script the crates a subdir vin var/www regardless what im
doing this creates a file with tha name of the directory.the mode option
and verbose donsn't make anything better.
The only situation this works correct is when I debug the script or the
line with -x
I haven't any Idea why this is how it is and I guess this needs further
testing.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#15168
; Package
coreutils
.
(Fri, 23 Aug 2013 18:34:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 15168 <at> debbugs.gnu.org (full text, mbox):
tag 15168 + moreinfo
thanks
horvan dillus wrote:
> three scripts here
> first one getit.sh to get some scripts with wget
Please one bug per bug report. Three bugs would mean three separate
reports please. One bug per report.
Note that wget is a different project and any wget bugs would need to
be reported to them not us. We don't have anything to do with wget here.
> second one install.sh to run the scripts and set up some things with bash
??
> third one the script the crates a subdir vin var/www regardless what im
> doing this creates a file with tha name of the directory.the mode option
> and verbose donsn't make anything better.
Please try to reduce the problem to a small test case. Show us
exactly what you are doing so that we can reproduce the problem. If
we can't understand what you are doing then we can't reproduce it and
can't fix it.
> The only situation this works correct is when I debug the script or the
> line with -x
>
> I haven't any Idea why this is how it is and I guess this needs further
> testing.
Unfortunately you haven't told us anything about the problem. You say
that mkdir is creating files not directories. But that is obviously
not right since mkdir creates directories not files. Please describe
exactly what you are doing. Saying that some script does something
wrong is not enough information.
If the problem is buried in some script then the simplest reason for a
problem is that the script has a bug in it and not a problem with
mkdir that is used by zillions of people in zillions of scripts every
day. The simplest explanation is usually the correct one.
Bob
Added tag(s) moreinfo.
Request was from
Bob Proulx <bob <at> proulx.com>
to
control <at> debbugs.gnu.org
.
(Fri, 23 Aug 2013 18:34:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#15168
; Package
coreutils
.
(Fri, 23 Aug 2013 18:49:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 15168 <at> debbugs.gnu.org (full text, mbox):
Horvan, Please use reply-all to keep the bug log in the recipient list
rather than reply to me privately. That way all of the team can
participate. The bug log is that 15168 address in the recipient list.
Thanks. I forward this to the bug log.
horvan dillus wrote:
> This is just one bug related to mkdir The short version of this
> could be I ran mkdir in a sub sub shell and it creates a file
> instead a directory as i mentioned in the subject. this has nothing
> to do with wget. Sorry for the missunderstanding
Please show us exactly what you did to cause mkdir to create a file
instead of a directory. The use of a sub sub shell will not matter to
mkdir.
Until we see how you did this we will think it is not a bug in mkdir
but is instead a bug in your script. But if you show us then all
doubt is removed. Please show us.
Bob
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#15168
; Package
coreutils
.
(Fri, 23 Aug 2013 19:13:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 15168 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
For a better ovvervie I'll post the 4 scripts I mentioned above:
Script one is written by a presiding file into .bashrc with the preeeded
user ubuntu.
#/!bin/bash
# Bootstrap for first installation and Update.
# This file have to be in loaded in the preseed file.
cat << EOF >> /home/ubuntu/.bashrc
if [ ! -d /opt/.drubuntu ]; then
echo "We needd yourr password agin to finish the initial setup"
sudo mkdir /opt/.drubuntu;cd /opt/.drubuntu;
wget http://drubuntu.googlecode.com/git/scripts/getit.sh >/dev/null 2>&1
chmod +x /opt/.drubuntu/getit.sh
./getit.sh
fi
if [ -f /opt/.drubuntu/.bash_aliases } then;
. /opt/.drubuntu/.bash_aliases
fi
EOF
The second script is the script that fetches and runs install.sh
#!/bin/bash
export username=`echo $LOGNAME`
DLURL=http://drubuntu.googlecode.com/git
DIRURL=/opt/.drubuntu
ISCRIPTSURL=/opt/.drubuntu/install
echo "We need your password to finish the initial setup"
sudo chown -Rh "$username" /opt/.drubuntu
echo "prepering initial set up"
mkdir $ISCRIPTSURL
wget -O $DIRURL/setip $DLURL/scripts/setip.sh > /dev/null 2>&1
wget -O $DIRURL/setwallpaper $DLURL/scripts/setwallpaper.sh > /dev/null 2>&1
wget -O $DIRURL/install.sh $DLURL/scripts/install/install.sh > /dev/null 2>&1
wget -O $DIRURL/features $DLURL/features/features.sh > /dev/null 2>&1
wget -O $ISCRIPTSURL/copyfiles $DLURL/scripts/install/copyfiles.sh >
/dev/null 2>&1
wget -O $ISCRIPTSURL/deb-packages
$DLURL/scripts/install/deb-packages.sh > /dev/null 2>&1
wget -O $ISCRIPTSURL/downloadfiles
$DLURL/scripts/install/downloadfiles.sh > /dev/null 2>&1
wget -O $ISCRIPTSURL/drupal7-core-setup
$DLURL/scripts/install/drupal7-core-setup.sh > /dev/null 2>&1
wget -O $ISCRIPTSURL/drupal8-core-setup
$DLURL/scripts/install/drupal8-core-setup.sh > /dev/null 2>&1
wget -O $ISCRIPTSURL/cleanup $DLURL/scripts/install/cleanup.sh > /dev/null 2>&1
chmod +x $DIRURL/*; chmod +x $ISCRIPTSURL/*
sudo bash "$DIRURL"/install.sh
the third script runs the script where the mkdir command is present
#!/bin/bash
if [[ $UID -ne 0 ]]; then
echo "This script must be run as root, use sudo ./install.sh"
exit
fi
echo "We'll now install all missing packages. This will take a while."
./install/deb-packages
# > /dev/null to hide the output
#uploadprogress setup
pecl install uploadprogress > /dev/null 2>&1;
#Check for uploadprogress
file="/etc/php5/conf.d/uploadprogress.ini"
if [ -f "$file" ]
then
echo "uploadprogress is already installed"
else
echo "extension=uploadprogress.so" >>/etc/php5/conf.d/uploadprogress.ini
fi
#fetch required files
echo "Files needed will be downloaded now..."
./install/downloadfiles;
echo "Required files will be copied to their locations"
./install/copyfiles;
# grant previleges
chown -Rh "$username":www-data /var/www;
#create symbolic links
ln -s /var/www $HOME/public_html;
#setting up server
hostname drupal.site;
sudo a2enmod rewrite;
sudo a2dissite default;
sudo a2ensite drupal;
sudo service apache2 restart;
echo "Setting up Drush and Drupal"
./install/drupal7-core-setup
read -p "Press [Enter] key if you have noted yourtr password..."
#set privileges
chown -Rh ubuntu:www-data /home/ubuntu/.drush;
chown -Rh ubuntu:www-data /home/ubuntu/.drush/cache
chown -Rh ubuntu:www-data /home/ubuntu/.drush/cache/default
chown -Rh ubuntu:www-data /home/ubuntu/.drush/cache/usage
./install/cleanup
chown -Rh "$username" /opt/.drubuntu
echo ""
echo "To change the MySql Root PWD 'MyRoot' enter"&&
echo ""
echo "mysql_secure_installation"&&
echo ""&&
echo "and follow the advice of the script! Your preseted password for MySql
is MyRoot'"
./features --plymouth > /dev/null
reboot -p
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*
cd /var/www/d7
drush -y dl drupal;
cd drup*;
cp -r .htaccess .gitignore /var/www/d7;
cp -r * /var/www/d7
cd /var/www/d7
rm -r drup*;
mkdir /var/www/d7/sites/default/files;
chmod 777 /var/www/d7/sites/default/files;
cp -r "/var/www/d7/sites/default/default.settings.php"
"/var/www/d7/sites/default/settings.php";
chmod 777 /var/www/d7/sites/default/settings.php;
wget -O /var/www/d7/setupsite $DLURL/scripts/setupsite.sh >/dev/null 2>&1;
chmod +x /var/www/d7/setupsite;
chown -Rh "$username":www-data /var/www;
chmod 644 /var/www/d7/.htaccess;
chmod 644 "/var/www/d7/sites/default/settings.php";
chmod 644 "/var/www/d7/sites/default/default.settings.php"
sudo bash setupsite
cd /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.
There are more scripts of course I hope this will be enough information to
exermain if this is really a bug.
2013/8/23 Bob Proulx <bob <at> proulx.com>
> Horvan, Please use reply-all to keep the bug log in the recipient list
> rather than reply to me privately. That way all of the team can
> participate. The bug log is that 15168 address in the recipient list.
> Thanks. I forward this to the bug log.
>
> horvan dillus wrote:
> > This is just one bug related to mkdir The short version of this
> > could be I ran mkdir in a sub sub shell and it creates a file
> > instead a directory as i mentioned in the subject. this has nothing
> > to do with wget. Sorry for the missunderstanding
>
> Please show us exactly what you did to cause mkdir to create a file
> instead of a directory. The use of a sub sub shell will not matter to
> mkdir.
>
> Until we see how you did this we will think it is not a bug in mkdir
> but is instead a bug in your script. But if you show us then all
> doubt is removed. Please show us.
>
> Bob
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#15168
; Package
coreutils
.
(Sat, 24 Aug 2013 18:47:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 15168 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#15168
; Package
coreutils
.
(Tue, 23 Oct 2018 22:55:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 15168 <at> debbugs.gnu.org (full text, mbox):
close 15168
stop
(triaging old bugs)
On 24/08/13 12:46 PM, Bob Proulx wrote:
> horvan dillus wrote:
>> For a better ovvervie I'll post the 4 scripts I mentioned above:
>
[...]
> 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.
[...]
>
>> 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.
>
With no further comments in 5 years, I'm closing this bug.
-assaf
bug closed, send any further explanations to
15168 <at> debbugs.gnu.org and horvan dillus <horvandillus <at> gmail.com>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 23 Oct 2018 22:55:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 21 Nov 2018 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.