tools/pygrub: do not override pygrub with a symbolic link
PATCH 1/1 tools/pygrub: do not override pygrub with a symbolic link
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.
tools/pygrub/Makefile +2 -2
@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ - "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ fi .PHONY: clean
commit 78128508937af187889806b9be3de0d49b8915fa
Author: Christoph Egger <[email protected]> Date: Fri Feb 8 12:44:12 2013 +0000
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR)
and $(PRIVATE_BINDIR) are the same.
Signed-off-by: Christoph Egger <[email protected]>tools/pygrub/Makefile +2 -2
@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ - "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ fi .PHONY: clean
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 2 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.
More properly this is "fix the if condition we use to decide when to create the symlink", since it is already the intention to not override if they are the same but the condition is written wrong since it includes DESTDIR on one side but not the other, which defeats the check.
FWIW I would niuke the DESTDIR on the left rather than adding it on the right, it might even fit on one line then?
tools/pygrub/Makefile install: all · line 19
Quoted 13 lines
Signed-off-by Christoph Egger <[email protected]>tools/pygrub/Makefile +2
-2@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ - "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \
I don't think this change to the first path passed to ln is correct since this will become the content of the symlink, which doesn't want to include DESTDIR.
Ian.
Quoted 11 lines · Ian Campbell
Quoted 2 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.More properly this is "fix the if condition we use to decide when to create the symlink", since it is already the intention to not override if they are the same but the condition is written wrong since it includes DESTDIR on one side but not the other, which defeats the check.
FWIW I would niuke the DESTDIR on the left rather than adding it on the right, it might even fit on one line then?
Does not work. See comment below.
Quoted 10 lines
Quoted 10 lines
Signed-off-by Christoph Egger <[email protected]>tools/pygrub/Makefile +0
-0@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \
Quoted 8 lines
tools/pygrub/Makefile install: all · line 19
Quoted 4 lines
tools/pygrub/Makefile +2
-2- "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \I don't think this change to the first path passed to ln is correct since this will become the content of the symlink, which doesn't want to include DESTDIR.
What actually happens when $(BINDIR) and $(PRIVATE_BINDIR) are equal is that the pygrub python script does not exist. pygrub is a symbolic link to a file that doesn't exist instead.
With this patch you will actually install the pygrub python script rather a symbolic link.
Christoph
Quoted 10 lines · Christoph Egger
Quoted 9 lines · Ian Campbell
Quoted 2 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.More properly this is "fix the if condition we use to decide when to create the symlink", since it is already the intention to not override if they are the same but the condition is written wrong since it includes DESTDIR on one side but not the other, which defeats the check.
Quoted 4 lines
Quoted 2 lines
FWIW I would niuke the DESTDIR on the left rather than adding it on the right, it might even fit on one line then?
Does not work. See comment below.
OK, that makes sense I guess.
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Signed-off-by Christoph Egger <[email protected]>tools/pygrub/Makefile +0
-0@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \Quoted 8 lines
tools/pygrub/Makefile install: all · line 19
Quoted 4 lines
tools/pygrub/Makefile +2
-2- "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \I don't think this change to the first path passed to ln is correct since this will become the content of the symlink, which doesn't want to include DESTDIR.
Quoted 6 lines
What actually happens when $(BINDIR) and $(PRIVATE_BINDIR) are equal is that the pygrub python script does not exist. pygrub is a symbolic link to a file that doesn't exist instead.
With this patch you will actually install the pygrub python script rather a symbolic link.
The code inside the if shouldn't even be run in the case you are trying to fix.
But you have broken the case where BINDIR and PRIVATE_BINDIR differ because /usr/bin/pygrub will be a symlink
to /tmp/destdir.XYZ/usr/lib/xen/bin/pygrub and not
to /usr/lib/xen/bin/pygrub.
Ian.
Quoted 40 lines · Ian Campbell
Quoted 10 lines · Christoph Egger
Quoted 9 lines · Ian Campbell
Quoted 2 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.More properly this is "fix the if condition we use to decide when to create the symlink", since it is already the intention to not override if they are the same but the condition is written wrong since it includes DESTDIR on one side but not the other, which defeats the check.
Quoted 4 lines
Quoted 2 lines
FWIW I would niuke the DESTDIR on the left rather than adding it on the right, it might even fit on one line then?
Does not work. See comment below.
OK, that makes sense I guess.
Quoted 22 lines
Quoted 9 lines
Quoted 9 lines
Signed-off-by Christoph Egger <[email protected]>tools/pygrub/Makefile +0
-0@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \Quoted 8 lines
tools/pygrub/Makefile install: all · line 19
Quoted 4 lines
tools/pygrub/Makefile +2
-2- "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \I don't think this change to the first path passed to ln is correct since this will become the content of the symlink, which doesn't want to include DESTDIR.
What actually happens when $(BINDIR) and $(PRIVATE_BINDIR) are equal is that the pygrub python script does not exist. pygrub is a symbolic link to a file that doesn't exist instead.
Quoted 7 lines
Quoted 2 lines
With this patch you will actually install the pygrub python script rather a symbolic link.
But you have broken the case where BINDIR and
PRIVATE_BINDIRdiffer because/usr/bin/pygrubwill be a symlink
to/tmp/destdir.XYZ/usr/lib/xen/bin/pygruband not
to/usr/lib/xen/bin/pygrub.
I see.
Quoted 3 lines
The code inside the if shouldn't even be run in the case you are trying to fix.
Right. Comparing $(DESTDIR)/$(BINDIR) with $(PRIVATE_BINDIR) is always different. Also when comparing $(BINDIR) with $(DESTDIR)/$(PRIVATE_BINDIR) is always different
and the code inside the if runs.
This works for me and should be fine for you:
if [ $(BINDIR) != $(PRIVATE_BINDIR) -a \
"`readlink -f $(DESTDIR)/$(BINDIR)`" != \
"`readlink -f $(PRIVATE_BINDIR)`" ]; then \ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \
Christoph
Quoted 55 lines · Christoph Egger
Quoted 40 lines · Ian Campbell
Quoted 10 lines · Christoph Egger
Quoted 9 lines · Ian Campbell
Quoted 2 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.More properly this is "fix the if condition we use to decide when to create the symlink", since it is already the intention to not override if they are the same but the condition is written wrong since it includes DESTDIR on one side but not the other, which defeats the check.
Quoted 4 lines
Quoted 2 lines
FWIW I would niuke the DESTDIR on the left rather than adding it on the right, it might even fit on one line then?
Does not work. See comment below.
OK, that makes sense I guess.
Quoted 22 lines
Quoted 9 lines
Quoted 9 lines
Signed-off-by Christoph Egger <[email protected]>tools/pygrub/Makefile +0
-0@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \Quoted 8 lines
tools/pygrub/Makefile install: all · line 19
Quoted 4 lines
tools/pygrub/Makefile +2
-2- "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \I don't think this change to the first path passed to ln is correct since this will become the content of the symlink, which doesn't want to include DESTDIR.
What actually happens when $(BINDIR) and $(PRIVATE_BINDIR) are equal is that the pygrub python script does not exist. pygrub is a symbolic link to a file that doesn't exist instead.
Quoted 7 lines
Quoted 2 lines
With this patch you will actually install the pygrub python script rather a symbolic link.
But you have broken the case where BINDIR and
PRIVATE_BINDIRdiffer because/usr/bin/pygrubwill be a symlink
to/tmp/destdir.XYZ/usr/lib/xen/bin/pygruband not
to/usr/lib/xen/bin/pygrub.I see.
Quoted 3 lines
The code inside the if shouldn't even be run in the case you are trying to fix.
Quoted 6 lines
Right. Comparing $(DESTDIR)/$(BINDIR) with $(PRIVATE_BINDIR) is always different. Also when comparing $(BINDIR) with $(DESTDIR)/$(PRIVATE_BINDIR) is always different
and the code inside the if runs.This works for me and should be fine for you:
I think so too.
Quoted 8 lines
if [ $(BINDIR) != $(PRIVATE_BINDIR) -a \ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \
Christoph
Quoted 56 lines · Ian Campbell
Quoted 55 lines · Christoph Egger
Quoted 40 lines · Ian Campbell
Quoted 10 lines · Christoph Egger
Quoted 9 lines · Ian Campbell
Quoted 2 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same.More properly this is "fix the if condition we use to decide when to create the symlink", since it is already the intention to not override if they are the same but the condition is written wrong since it includes DESTDIR on one side but not the other, which defeats the check.
Quoted 4 lines
Quoted 2 lines
FWIW I would niuke the DESTDIR on the left rather than adding it on the right, it might even fit on one line then?
Does not work. See comment below.
OK, that makes sense I guess.
Quoted 22 lines
Quoted 9 lines
Quoted 9 lines
Signed-off-by Christoph Egger <[email protected]>tools/pygrub/Makefile +0
-0@@ -15,8 +15,8 @@ install: all --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \Quoted 8 lines
tools/pygrub/Makefile install: all · line 19
Quoted 4 lines
tools/pygrub/Makefile +2
-2- "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ - ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ + "`readlink -f $(DESTDIR)/$(PRIVATE_BINDIR)`" ]; then \ + ln -sf $(DESTDIR)/$(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \I don't think this change to the first path passed to ln is correct since this will become the content of the symlink, which doesn't want to include DESTDIR.
What actually happens when $(BINDIR) and $(PRIVATE_BINDIR) are equal is that the pygrub python script does not exist. pygrub is a symbolic link to a file that doesn't exist instead.
Quoted 7 lines
Quoted 2 lines
With this patch you will actually install the pygrub python script rather a symbolic link.
But you have broken the case where BINDIR and
PRIVATE_BINDIRdiffer because/usr/bin/pygrubwill be a symlink
to/tmp/destdir.XYZ/usr/lib/xen/bin/pygruband not
to/usr/lib/xen/bin/pygrub.I see.
Quoted 3 lines
The code inside the if shouldn't even be run in the case you are trying to fix.
Quoted 8 lines
Quoted 6 lines
Right. Comparing $(DESTDIR)/$(BINDIR) with $(PRIVATE_BINDIR) is always different. Also when comparing $(BINDIR) with $(DESTDIR)/$(PRIVATE_BINDIR) is always different
and the code inside the if runs.This works for me and should be fine for you:
I think so too.
Great. Attached this new version.
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR)
and $(PRIVATE_BINDIR) are the same.
Signed-off-by: Christoph Egger <[email protected]>tools/pygrub/Makefile +2 -1
@@ -14,7 +14,8 @@ install: all $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \ --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot - set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ + set -e; if [ $(BINDIR) != $(PRIVATE_BINDIR) -a \ + "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ fi
Christoph
commit 80034731fee32b4c4c1c5c326a265e6f75469a8f
Author: Christoph Egger <[email protected]> Date: Fri Feb 8 12:44:12 2013 +0000
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR)
and $(PRIVATE_BINDIR) are the same.
Signed-off-by: Christoph Egger <[email protected]>tools/pygrub/Makefile +2 -1
@@ -14,7 +14,8 @@ install: all $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \ --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot - set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ + set -e; if [ $(BINDIR) != $(PRIVATE_BINDIR) -a \ + "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ fi
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Matt Wilson
Reviewed-byQuoted 5 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR)
and $(PRIVATE_BINDIR) are the same.
Signed-off-by: Christoph Egger <[email protected]>This one looks good to me too.
Quoted 18 lines
tools/pygrub/Makefile +2
-1@@ -14,7 +14,8 @@ install: all $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \ --install-scripts=$(PRIVATE_BINDIR) --force $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot - set -e; if [ "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ + set -e; if [ $(BINDIR) != $(PRIVATE_BINDIR) -a \ + "`readlink -f $(DESTDIR)/$(BINDIR)`" != \ "`readlink -f $(PRIVATE_BINDIR)`" ]; then \ ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ fiChristoph
Quoted 10 lines · Matt Wilson
Quoted 5 lines · Christoph Egger
tools/pygrub: Do not override pygrub with a symbolic link if $(BINDIR) and $(PRIVATE_BINDIR) are the same. Signed-off-by: Christoph Egger <[email protected]>This one looks good to me too.
Reviewed-by Matt Wilson <[email protected]>
Thanks, also acked + applied. I rewrote the commit message as follows so that the initial summary line was < 80 characters
tools/pygrub: Fix install when $(BINDIR) and $(PRIVATE_BINDIR) are the same
Do not override pygrub with a symbolic link in this case.