SliTaz SliTaz Forum

You are not logged in.

#1 2014-05-24 14:17:07

llev
Member
Registered: 2011-12-09
Posts: 568

Bug in some coreutils packages?

Hi,

I encountered a big problem with some coreutils package (-directory and -file-output-full): after installation, the /bin tools they're supposed to provide (ls, cat) are not there! No link to busybox left, no binary installed.

(Fortunately, the install of all coreutils packages failed before reaching coreutils-operations, so "ln" was still here and I could rescue my system by restoring the links from ls and cat to busybox.

Happened on two different PCs running SliTaz 5-RC1 from harddisk.

Offline

#2 2014-05-25 15:37:44

Trixar_za
Administrator
Registered: 2011-03-29
Posts: 1,506

Re: Bug in some coreutils packages?

Something tells me you removed busybox after you installed those two packages. Simply put, when you uninstalled busybox it took the cat and ls commands with it - as in it tried to delete it's own symlinks, but ended up deleting the real programs instead. You also broke some scripts that depend on Busybox like tazpkg and tazpanel in the process. Why not leave it on the system? It's only ~2Mb.

Offline

#3 2014-05-26 07:35:19

llev
Member
Registered: 2011-12-09
Posts: 568

Re: Bug in some coreutils packages?

Thanks for answering.

Please be assured that I'm not *that* stupid :-) I know busybox is used for many other tools.

What I did is simply select all coreutils-* packages and click "Install". (This fails at some point, because missing cat and ls prevents installation of packages.)

Is there a way I can debug tazpkg execution?

Offline

#4 2014-05-26 09:10:06

mojo
Administrator
Registered: 2011-03-29
Posts: 2,173

Re: Bug in some coreutils packages?

@llev

coreutils-directory and coreutils-file-output-full tazpkgs both fail to install on 5.0-rc2.

Both files install with tazpkg 5.1

tazpkg 5.3 is the problem.

[c]tazpkg install-list[/c] fails on tazpkg 5.3 as well.

Offline

#5 2014-05-26 10:48:12

llev
Member
Registered: 2011-12-09
Posts: 568

Re: Bug in some coreutils packages?

Maybe line 677 is the culprit?

http://hg.slitaz.org/tazpkg/file/a13b253c2415/tazpkg#l677

From what I understand, pre_install commands are executed before it, so "ls" has been removed.

Why not remove the "rm" preinstall commands, and add a force option to "cp" in line 677 so that /bin/ls is simply overwritten?

Offline

#6 2014-05-26 11:01:26

mojo
Administrator
Registered: 2011-03-29
Posts: 2,173

Re: Bug in some coreutils packages?

llev you found the line with the problem :^)

Tazpkg 5.1 which works doesn't have whats in bold on line 677

I removed whats in bold from tazpkg 5.3

[ "$(ls fs/* 2> /dev/null)" ] && cp -a fs/* $ROOT/

Now coreutils-directory and coreutils--file-output-full install

Reverting this commit will fix the package install problem.

http://hg.slitaz.org/tazpkg/rev/34d80c8f0619

Offline

#7 2014-05-26 12:07:34

llev
Member
Registered: 2011-12-09
Posts: 568

Re: Bug in some coreutils packages?

I guess the commit was somehow useful, but maybe did not correct a critical bug? So will the devs accept reverting it?

Other commands invoked between lines 657-659 and line 677 are: cp, cpio, find, gzip. So the relevant packages may break as well.

I really think one should use "cp -af" and remove the preinstall "rm" commands in those packages, but I'm no expert at all...

Offline

#8 2014-05-26 12:21:40

llev
Member
Registered: 2011-12-09
Posts: 568

Re: Bug in some coreutils packages?

Likewise, on line 2084 "grep" is called after removing of files and before post_remove, so removing package "grep" may be broken.

Also, "rmdir" is used in remove_with_path; GNU rmdir comes with "coreutils-file-special".

Offline

#9 2014-05-26 12:36:09

llev
Member
Registered: 2011-12-09
Posts: 568

Re: Bug in some coreutils packages?

A possible workaround/patch, modifying the package receipt, e.g. for "ls" in "coreutils-directory", would be:

------------------------------------------------------------------------------------

genpkg_rules()

{

    mkdir -p $fs/bin

#    cp -a $install/usr/bin/ls $fs/bin

    cp -a $install/usr/bin/ls $fs/bin/gnu-ls

    mkdir -p $fs/usr/bin

    cp -a $install/usr/bin/dir $fs/usr/bin

    cp -a $install/usr/bin/vdir $fs/usr/bin

    cp -a $install/usr/bin/dircolors $fs/usr/bin

}

# Pre and post install commands for Tazpkg.

# We must remove all Busybox symlink before installing.

#

pre_install()

{

    local root

    root=$1

    echo "Processing pre-install commands..."

    echo -n "Removing all Busybox replaced utils... "

#    rm -f $root/bin/ls $root/usr/bin/dir $root/usr/bin/vdir $root/usr/bin/dircolors

    rm -f $root/usr/bin/dir $root/usr/bin/vdir $root/usr/bin/dircolors

    status

}

post_install()

{

...

    rm -f $root/bin/ls

    mv $fs/bin/gnu-ls $root/bin/ls

...

}

------------------------------------------------------------------------------------

BUT this requires executing post_install BEFORE removing tmp files (lines 687-694).

Or put GNU ls in /usr/bin in the package, then move it to /bin in post_install (as is done for "cp" in package "coreutils").

Offline

#10 2014-05-26 13:45:03

lexeii
Administrator
Registered: 2012-03-21
Posts: 1,853

Re: Bug in some coreutils packages?

Hi there!

Seems like issue is fixed now. Please test and feedback.

Use this patch to your RC2 system: http://people.slitaz.org/~lexeii/coreutils.patch

These patches you'll find here:

http://hg.slitaz.org/slitaz-base-files/rev/02334b7ae2f7

http://hg.slitaz.org/tazpkg/rev/870805534046

New packages you can download here right now:

http://cook.slitaz.org/cooker.cgi?download=slitaz-base-files-5.6.3.tazpkg

http://cook.slitaz.org/cooker.cgi?download=tazpkg-5.3.1.tazpkg

Sorry, I don't know how to move new packages to mirror (to be available with "tazpkg recharge" etc.)

Again, please test & feedback.

Offline

#11 2014-05-26 14:28:27

lexeii
Administrator
Registered: 2012-03-21
Posts: 1,853

Re: Bug in some coreutils packages?

And I want to say thank you, llev!

Here is +32°C outside my flat and my head not works well smile

Next, I think its need some explainations.

Busybox is core package, and we can't remove it. So busybox is always accessible for our system.

Busybox is multicall binary, and we can access its applets in two ways:

First. Make symlinks like /bin/ls -> busybox

And use it like: [c]ls /home/tux[/c]

Second. No need to use symlinks

And use it like: [c]busybox ls /home/tux[/c]

So we need to prepend critical busybox commands to make sure all they works in any case (with or without symlinks exists).

I see you speak about other busybox commands possibly affected only after I've make my patch.

My patch works for all coreutils* packages. But we need more patches for other packages that substitutes busybox's symlinks. It need time for me, and any help (to patch tazpkg, slitaz-base-files and other files affected) is appreciated.

Offline

#12 2014-05-28 08:53:36

llev
Member
Registered: 2011-12-09
Posts: 568

Re: Bug in some coreutils packages?

Hi,

OK, I see in the receipt of package "busybox" that it cannot be removed. So we just have to patch tazpkg, and the receipts of other packages (coreutils-*, grep, find...) can be left unchanged.

Well, attaching my diff fails. Tell me how I can send it to you. I post it below, but all tabs will be lost I fear:

--- tazpkg      2014-05-28 10:16:54.599867816 +0200

+++ tazpkg.new  2014-05-28 10:37:56.162096117 +0200

@@ -517,17 +517,17 @@

        [ "$1" ] || return

        local dir

-       rm -f $1 2>/dev/null

+       busybox rm -f $1 2>/dev/null

        dir="$1"

        while [ "$dir" != "/" ]; do

                dir="$(dirname $dir)"

-               rmdir $dir 2> /dev/null || break

+               busybox rmdir $dir 2> /dev/null || break

        done

}

grepesc()

{

-       sed 's/\[/\\[/g'

+       busybox sed 's/\[/\\[/g'

}

# This function installs a package in the rootfs.

@@ -661,20 +661,23 @@

                # save 'official' configuration files

                action "Saving configuration files for \$PACKAGE..."

                for i in $CONFIG_FILES; do

-                       { cd fs ; find ${i#/} -type f 2> /dev/null; cd ..; }

-               done | { cd fs ; cpio -o -H newc --quiet | gzip -9; cd ..; } > \

+                       { cd fs ; busybox find ${i#/} -type f 2> /dev/null;

+                         cd ..; }

+               done | { cd fs ; busybox cpio -o -H newc --quiet | \

+                        busybox gzip -9; cd ..; } > \

                        $ROOT$INSTALLED/$PACKAGE/volatile.cpio.gz

                # keep user configuration files

                for i in $CONFIG_FILES; do

-                       { cd fs ; find ${i#/} -type f 2> /dev/null; cd ..; }

+                       { cd fs ; busybox find ${i#/} -type f 2> /dev/null;

+                         cd ..; }

                done | while read i; do

                        [ -e $ROOT/$i ] || continue

-                       cp -a $ROOT/$i fs/$i

+                       busybox cp -a $ROOT/$i fs/$i

                done

                status

        fi

        action "Installing \$PACKAGE..."

-       [ "$(busybox ls fs/* 2> /dev/null)" ] && cp -a fs/* $ROOT/

+       [ "$(busybox ls fs/* 2> /dev/null)" ] && busybox cp -a fs/* $ROOT/

        status

        if [ -s files2remove.list ]; then

                action "Removing old \$PACKAGE..."

@@ -686,10 +689,10 @@

        fi

        # Remove the temporary random directory.

        action "Removing all tmp files..."

-       cd .. && rm -rf $TMP_DIR

+       cd .. && busybox rm -rf $TMP_DIR

        status

        # Post install commands.

-       if grep -q ^post_install $ROOT$INSTALLED/$PACKAGE/receipt; then

+       if busybox grep -q ^post_install $ROOT$INSTALLED/$PACKAGE/receipt; then

                post_install $ROOT

        fi

        # Update-desktop-database if needed.

@@ -2068,9 +2071,9 @@

                        if [ -f $ROOT$INSTALLED/$PACKAGE/modifiers ]; then

                                for file in [c]cat $ROOT$INSTALLED/$PACKAGE/files.list[/c]

                                do

-                                       for mod in [c]cat $ROOT$INSTALLED/$PACKAGE/modifiers[/c]

+                                       for mod in [c]busybox cat $ROOT$INSTALLED/$PACKAGE/modifiers[/c]

                                        do

-                                               [ -f $ROOT$INSTALLED/$mod/files.list ] && [ $(grep "^$(echo $file | grepesc)$" $ROOT$INSTALLED/$mod/files.list | wc -l) -gt 1 ] && continue 2

+                                               [ -f $ROOT$INSTALLED/$mod/files.list ] && [ $(busybox grep "^$(echo $file | grepesc)$" $ROOT$INSTALLED/$mod/files.list | busybox wc -l) -gt 1 ] && continue 2

                                        done

                                        remove_with_path $ROOT$file

                                done

@@ -2081,7 +2084,7 @@

                                done

                        fi

                        status

-                       if grep -q ^post_remove $ROOT$INSTALLED/$PACKAGE/receipt; then

+                       if busybox grep -q ^post_remove $ROOT$INSTALLED/$PACKAGE/receipt; then

                                post_remove $ROOT

                        fi

                        # Remove package receipt.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 1.57 MiB (Peak: 1.77 MiB) ]