bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #44115] test EXPR1 -a EXPR2 always true when EXPR1 deals with exist


From: adrian15
Subject: [bug #44115] test EXPR1 -a EXPR2 always true when EXPR1 deals with existing filesystem object
Date: Thu, 29 Jan 2015 07:00:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.2.0

URL:
  <http://savannah.gnu.org/bugs/?44115>

                 Summary: test EXPR1 -a EXPR2 always true when EXPR1 deals
with existing filesystem object
                 Project: GNU GRUB
            Submitted by: adrian15sgd
            Submitted on: jue 29 ene 2015 07:00:40 GMT
                Category: Terminal
                Severity: Major
                Priority: 5 - Normal
              Item Group: Software Error
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 
                 Release: Git master
         Reproducibility: Every Time
         Planned Release: None

    _______________________________________________________

Details:

Jessie chroots - Package I installed
--------------------------------------------

python autoconf bison flex unicode libfreetype6-dev

Affected GIT commit
-------------------

2da4171eabfe0d1b9b1be6146f628099d08aac02

Build system
-------------

Jessie from 12 January 2015
Build options

./configure --with-platform=efi at first pass.
./configure --with-platform=pc at second pass.

How do I build and prepare my system
------------------------------------
Make sure no Debian grub package is found in chroot

apt-get remove '.grub.'
Grub2 (efi+pc)) Build and installation

# Make sure we are testing the right revision
mkdir grub_upstream
cd grub_upstream
git clone git://git.savannah.gnu.org/grub.git .
git checkout COMMIT-TO-TEST
# Remove any non git related file - BEGIN
git reset --hard
git clean -f -d
git clean -f -x -d

# Remove any non git related file - END
# Build efi based grub and install it - BEGIN
./autogen.sh && ./configure --enable-grub-mkfont --with-platform=efi && make
# Dont forget to delete any rest of previous installation - BEGIN
sudo rm -rf /usr/local/etc/grub.d/ /usr/local/bin/grub-*
/usr/local/share/grub/
# Dont forget to delete any rest of previous installation - END
sudo make install
# Build efi based grub and install it - END
make clean # Prepare for next build
./configure --enable-grub-mkfont --with-platform=pc && make # Prepare for a
i386 build
sudo make install # Install i386 build

Super Grub2 Disk build
----------------------
grub-mkrescue --output=/tmp/test1.iso

VM system
----------
QEMU emulator version 2.1.2 (Debian 2.1+dfsg-7+b1)

kvm -bios /usr/share/ovmf/OVMF.fd -boot c -hda
/home/adrian/gnu/rescatux/jessie_chroot/tmp/sg2d_efi_hdd.iso

How to reproduce the bug
-------------------------
If needed press 'c' to go to grub shell.

# When the evaluation is true we print "yes"
# When the evaluation is false we print "no"

# Let's begin with a simple example

if test "one" = "one" -a "one" = "two" ; then echo "yes" ; else echo "no" ;
fi

# The output is, as expected, "no".

# Now you should know that $prefix/grub.cfg exists in my grub2 disk

# Now let's make arise the bug

if test -f $prefix/grub.cfg -a "one" = "two" ; then echo "yes" ; else echo
"no" ; fi

# The output is "yes" while I was expecting it to be "no" !!!

# Now I'm going to try to inverse the order

if test  "one" = "two" -a -f $prefix/grub.cfg ; then echo "yes" ; else echo
"no" ; fi

# The output is, as expected, "no"

# Individual tests so that you see that they are ok

if test -f $prefix/grub.cfg ; then echo "yes" ; else echo "no" ; fi

# The output is, as expected, "yes"

if test -f $prefix/noexists.cfg ; then echo "yes" ; else echo "no" ; fi

# The output is, as expected, "no"

if test  "one" = "two" ; then echo "yes" ; else echo "no" ; fi

# The output is, as expected, "no"

# Let's check if it's variable parsing related

if test -f (hd0)/boot/grub/grub.cfg -a "one" = "two" ; then echo "yes" ; else
echo "no" ; fi

# The output is "yes" while I was expecting it to be "no" !!! That probably
means that variable parsing is not involved in the bug

# Let's try with "test -d" which seems similar to "test -f"

if test -d (hd0)/boot/grub -a "one" = "two" ; then echo "yes" ; else echo "no"
; fi

# The output is "yes" while I was expecting it to be "no" !!! That probably
means that this bug affects not only "test -f" but also expression evaluation
which handle opening of filesystem objects

# Additional information

* Quoting with (") $prefix/grub.cfg makes no difference.
* I have not been able to check at first place the bug with grub developers so
please check if I'm writing the if test else commands as I'm supposed to or
I'm adding non POSIX syntax or whatever I'm doing wrong.

Thank you for taking a look at the bug.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44115>

_______________________________________________
  Mensaje enviado vía/por Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]