Skip to contentSkip to conversation

musl: prevent errors if do_install is run more than once

PATCH In review Andre McCurdy 4 participants 8 messages Nov 30, 2017 – Dec 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 musl: prevent errors if do_install is run more than once

---
 meta/recipes-core/musl/musl_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/musl/musl_git.bb +2 -1
index 932c9a2..db26b4f 100644
@@ -57,10 +57,11 @@ do_install() {
 	oe_runmake install DESTDIR='${D}'
 
 	install -d ${D}${bindir}
+	rm -f ${D}${bindir}/ldd
 	lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
 	for l in crypt dl m pthread resolv rt util xnet
 	do
-		ln -s libc.so ${D}${libdir}/lib$l.so
+		ln -sf libc.so ${D}${libdir}/lib$l.so
 	done
 }
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Andre McCurdy
---
 meta/recipes-core/musl/musl_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/musl/musl_git.bb +0 -0
index 932c9a2..db26b4f 100644

meta/recipes-core/musl/musl_git.bb do_install() { · line 60

Quoted 4 lines
meta/recipes-core/musl/musl_git.bb +1 -0
@@ -57,10 +57,11 @@ do_install() {
        oe_runmake install DESTDIR='${D}'
 
        install -d ${D}${bindir}
+       rm -f ${D}${bindir}/ldd

Doesn't lnr take care of removing old file ?

meta/recipes-core/musl/musl_git.bb do_install() { · line 64

Quoted 5 lines
meta/recipes-core/musl/musl_git.bb +1 -1
        lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
        for l in crypt dl m pthread resolv rt util xnet
        do
-               ln -s libc.so ${D}${libdir}/lib$l.so
+               ln -sf libc.so ${D}${libdir}/lib$l.so

this is ok

Quoted 11 lines
meta/recipes-core/musl/musl_git.bb +0 -1
        done
 }
 
--

1.9.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 13 lines · Khem Raj
Quoted 12 lines · Andre McCurdy
---
 meta/recipes-core/musl/musl_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/musl/musl_git.bb +0 -0
index 932c9a2..db26b4f 100644
@@ -57,10 +57,11 @@ do_install() {
        oe_runmake install DESTDIR='${D}'
 
Quoted 4 lines

meta/recipes-core/musl/musl_git.bb do_install() { · line 60

Quoted 2 lines
meta/recipes-core/musl/musl_git.bb +1 -0
        install -d ${D}${bindir}
+       rm -f ${D}${bindir}/ldd

Doesn't lnr take care of removing old file ?

Apparently not:

  $ touch foo
  $ lnr xxx foo
  Traceback (most recent call last):
    File "/.../openembedded-core/scripts/lnr", line 21, in <module>
      os.symlink(target, linkname)
  FileExistsError: [Errno 17] File exists: 'xxx' -> 'foo'
#3 lore raw

Extend lnr to have a --force option?

Ross

Quoted 35 lines · Andre McCurdy
Quoted 1 line · Khem Raj

On Thu, Nov 30, 2017 at 12:20 PM, Andre McCurdy <[email protected]>

Quoted 6 lines · wrote:

Review

Quoted 6 lines
---
 meta/recipes-core/musl/musl_git.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/recipes-core/musl/musl_git.bb

Quoted 10 lines

meta/recipes-core/musl/musl_git.bb do_install() { · line 60

Quoted 8 lines

index 932c9a2..db26b4f 100644

meta/recipes-core/musl/musl_git.bb +1 -0
@@ -57,10 +57,11 @@ do_install() {
        oe_runmake install DESTDIR='${D}'
 
        install -d ${D}${bindir}
+       rm -f ${D}${bindir}/ldd

Doesn't lnr take care of removing old file ?

Apparently not:

  $ touch foo
  $ lnr xxx foo
  Traceback (most recent call last):
    File "/.../openembedded-core/scripts/lnr", line 21, in <module>
      os.symlink(target, linkname)
  FileExistsError: [Errno 17] File exists: 'xxx' -> 'foo'
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
#4 lore raw
Quoted 1 line · Ross

Extend lnr to have a --force option?

Is there ever a case where we want lnr to fail if the target already exists?

There are plenty of existing examples in oe-core where rm is run before lnr (and in the cases where it's not, it's perhaps just a bug or an oversight).

So I think either leave the v1 patch as-is and run rm before lnr in musl do_install as we already do elsewhere, or update lnr so that it unconditionally removes any pre-existing target?

#5 lore raw
Quoted 5 lines · Andre McCurdy
Quoted 1 line · Ross

Extend lnr to have a --force option?

Is there ever a case where we want lnr to fail if the target already exists?

Quoted 7 lines

There are plenty of existing examples in oe-core where rm is run before lnr (and in the cases where it's not, it's perhaps just a bug or an oversight).

So I think either leave the v1 patch as-is and run rm before lnr in musl do_install as we already do elsewhere, or update lnr so that it unconditionally removes any pre-existing target?

I like Ross'es suggestion to modify lnr implementation as an independent patch and
rebase your patch on top. Maybe a cleanup later to remove all rm cmds that are used
before lnr

#6 lore raw
Quoted 14 lines · Khem Raj
Quoted 5 lines · Andre McCurdy
Quoted 1 line · Ross

Extend lnr to have a --force option?

Is there ever a case where we want lnr to fail if the target already exists?

Quoted 7 lines

There are plenty of existing examples in oe-core where rm is run before lnr (and in the cases where it's not, it's perhaps just a bug or an oversight).

So I think either leave the v1 patch as-is and run rm before lnr in musl do_install as we already do elsewhere, or update lnr so that it unconditionally removes any pre-existing target?

Quoted 5 lines

I like Ross'es suggestion to modify lnr implementation as an independent patch and
rebase your patch on top. Maybe a cleanup later to remove all rm cmds that are used
before lnr

Do we keep the lnr filename? Change to ln-python and add -r and -f?

The above question wasn't answered. Should we just always force it and emit a WARNING if it's being replaced?

-M

#7 lore raw
Quoted 24 lines · Matthew McClintock
Quoted 1 line · Khem Raj

On Fri, Dec 1, 2017 at 11:30 AM, Andre McCurdy <[email protected]>

Quoted 1 line · wrote:
Quoted 1 line

On Fri, Dec 1, 2017 at 3:07 AM, Burton, Ross <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 1 line

Extend lnr to have a --force option?

Is there ever a case where we want lnr to fail if the target already

exists?

Quoted 9 lines
Quoted 8 lines

There are plenty of existing examples in oe-core where rm is run before lnr (and in the cases where it's not, it's perhaps just a bug or an oversight).

So I think either leave the v1 patch as-is and run rm before lnr in musl do_install as we already do elsewhere, or update lnr so that it unconditionally removes any pre-existing target?

Quoted 5 lines

I like Ross'es suggestion to modify lnr implementation as an independent patch and
rebase your patch on top. Maybe a cleanup later to remove all rm cmds that are used
before lnr

Quoted 4 lines

Do we keep the lnr filename? Change to ln-python and add -r and -f?

The above question wasn't answered. Should we just always force it and emit a WARNING if it's being replaced?

It’s should force replace it yes a note about replacing an existing file if any is fine

Quoted 4 lines

-M