LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackpkg vs. third-party package repository (https://www.linuxquestions.org/questions/slackware-14/slackpkg-vs-third-party-package-repository-4175427364/)

eduardr 04-04-2018 11:06 AM

Dialog formatting issues after recent '-current' updates
 
3 Attachment(s)
There have been a number of recent changes to ncurses and terminfo files that I believe are causing the slackpkg+ dialogs/UI to have formatting issues. For ex. a character appears and repeats a number of times in place of line drawing characters, some lines are not properly drawn. The dialogs are still perfectly usable - no functionality issues.

The regular slackpkg dialogs are fine (i.e. when turning slackpkg+ 'off').

My term setting (ssh'ing from MacOS):
declare -x TERM="xterm-256color"

Screenshots attached:

1 - Slackpkg - looks fine, no problems
2 - Slackpkg+ - reinstall dialog formatting issues
3 - Slackpkg+ - upgrade dialog formatting issues

zerouno 04-04-2018 05:16 PM

Thankyou to reporting.

I have to update my -current to replicate the problem.

Which is your current update? latest changelog is (now) Wed Apr 4 00:16:40 UTC 2018


also try to run
VERBOSE=3 slackpkg reinstall kernel
at the end of execution, the temporary directory /tmp/slackpkg.XXXX will be not removed.
attach the generated file 'dialog.tmp' from that directory


thankyou.

eduardr 04-04-2018 05:23 PM

I'm on Wed Apr 4 00:16:40 UTC 2018, attaching log
 
Thanks for looking into this.

My dialog.tmp contains just one line:

kernel-generic-4.14.32-x86_64-1.txz "slackware64" on

zerouno 04-04-2018 05:44 PM

Have you a way to access the machine in ssh from a linux machine and/or from the console (monitor attached) or just from mac?

Please give me
echo $TERM
before ssh, after ssh and after the 'su' command (before declare -x ... )

Edit: which character encoding are you using? (UTF-8 and so on).

eduardr 04-04-2018 06:05 PM

Direct terminal access: dialog looks perfect.

echo $TERM shows 'linux'

Also, direct terminal access -> run xfce (TERM=xterm-256color): perfect

The problem appears tied to the use of xterm-xxxx on Mac. I don't know why slackpkg+ specifically is affected - I suspect won't be easy to figure out.

These are the results from trying all the possibilities for MacOS Term settings with slackpkg+ dialogs:

xterm: problems
xterm-16color: problems
xterm-256color: problems
ansi: terrible
dtterm: perfect
nsterm: perfect
rxvt: perfect
vt52: doesn't work properly for anything
vt100: perfect (black & white)
vt102: perfect (black & white)

eduardr 04-04-2018 06:12 PM

Actually noticed one other thing: with xterm (-256color), on both direct terminal > xfce, and MacOS ssh, after exiting from slackpkg+ the screen doesn't get cleared - the dialog UI remains on screen, and the prompt appears in the middle of it. So xterm has problems of some kind with slackpkg+ even on direct linux console.

eduardr 04-06-2018 05:05 PM

2 Attachment(s)
Found issues with one screen in Slackware installer, and with the iptraf utility, all on Mac Terminal. Seems like an issue with dialog, which may not be fixable by slackpkg+. I'll probably need to file a slackware current bug, or dialog bug, but because it affects the Mac there will be little interest in fixing it I suspect.

zerouno 04-06-2018 05:24 PM

To fastest tests run
dialog --msgbox test 10 30
and
dialog --clear

Also run
VERBOSE=3 bash -x slackpkg upgrade kernel 2>slackpkg.trace
grep dialog slackpkg.trace|grep reinstall
You will find the exact command that slackpkg+ runs

Always annotate the $TERM before you run it.

zerouno 04-19-2018 12:53 AM

This may solve..
Quote:

l/ncurses-6.1_20180324-x86_64-4.txz: Rebuilt.
Change the xterm entry in xterm.terminfo (way down at the bottom, where it
says "customization begins here" and that we may need to change the xterm
entry since it is used "for a variety of incompatible terminal emulations")
to drop the use of use=rep+ansi. In addition to causing Konsole breakage, I
have verification that rep= was causing problems with terminals connecting
from OSX. Only the xterm entry has changed. Previously this was an alias for
xterm-new, which has not been altered. Feel free to use xterm-new instead if
it suits your needs better.

eduardr 04-21-2018 01:13 PM

dialog/ncurses issues solved by recent slackware -current
 
Thanks zerouno, those recent slackware -current changes fixed xterm connecting from MacOS.

Since the default MacOS term is actually xterm-256color, I had to apply a similar fix and build a custom ncurses (maybe slackware -current will also make this change in a future update).

$ vim <ncurses src slackbuild dir>/ncurses/terminfo/xterm.terminfo

~~~~~~

Original:

xterm-256color|xterm with 256 colors,
use=xterm+256color,
use=xterm-new,

~~~~~~

Modified:

xterm-256color|xterm with 256 colors,
use=xterm+256color,
use=xterm,

~~~~~~

I could make the same change to other xterm-XXcolor such as xterm-16color, but for me at least xterm-256color is the one I use so I only changed that one.

zerouno 05-21-2018 04:12 PM

1 Attachment(s)
EXPERIMENTAL FEATURE!!! -> Duplicate packages allowed in install dialog box

Apply patch to slackpkgplus.sh from slackpkg+-1.7.0d1-noarch-3mt.txz
Add in slackpkgplus.conf:
DIALOG=full


This patch add a version of the dialogbox in the install mode where the packages will be shown from all repositories, not just from the repository in configuration priority order, so I do not need to add single packages in PKGS_PRIORITY every time (and search in which repository is it)
By default the dialog mark as selected only the package in priority as from configuration. Then you can select the package you want.
(dangerous note: in that first draft slackpkg does not check if you have selected more than one package with the same name)

May be most useful to enable TAG_PRIORITY=on where do you set DIALOG=full, otherwise at the first slackpkg upgrade-all it will be replaced with the one in standard priority order.

This may replace slackpkg install repo:package where I don't know where to find the package (yes, I can run slackpkg search package, but this is another way)

NOTE: it is a MOST EXPERIMENTAL FEATURE, just to know if it may be useful/wanted. Someone asked for it in past.

know bug: if two different repositories have the SAME full-package-name (for example one in the -stable and one in -current), just one will be shown, the first in standard priority order.


test it with
DOWNLOADONLY=on slackpkg install package



Code:

--- slackpkgplus.sh 2018-05-21 22:39:12.493106875 +0200
+++ slackpkgplus.sh  2018-05-21 22:35:45.877042583 +0200
@@ -1221,7 +1221,6 @@
    done
  } # END function more_info()
 
-  if [ "$DIALOG" = "on" ] || [ "$DIALOG" = "ON" ]; then
    # Slackpkg+ Dialog functions
    # Original functions from slackpkg modified by Marek Wodzinski (majek@mamy.to)
    #
@@ -1306,6 +1305,7 @@
        --textbox $TMPDIR/Packages.clog 19 70
    } # END function showChangeLogInfo()
 
+  if [ "$DIALOG" = "on" ] || [ "$DIALOG" = "ON" ]; then
 
    # Show the lists and asks if the user want to proceed with that action
    # Return accepted list in $SHOWLIST
@@ -1367,6 +1367,237 @@
        HINT=""
      fi
 
+      # This is needed because dialog have a limit of arguments.
+      # This limit is around 20k characters in slackware 10.x
+      # Empiric tests on slackware 13.0 got a limit around 139k.
+      # If we exceed this limit, dialog got a terrible error, to
+      # avoid that, if the number of arguments is bigger than
+      # DIALOG_MAXARGS we remove the hints. If even without hints
+      # we can't got less characters than DIALOG_MAXARGS we give an
+      # error message to the user ask him to not use dialog
+      if [ $(wc -c $TMPDIR/dialog.tmp | cut -f1 -d\ ) -ge $DIALOG_MAXARGS ]; then
+        mv $TMPDIR/dialog.tmp $TMPDIR/dialog2.tmp
+        awk '{ NF=3 ; print $0 }' $TMPDIR/dialog2.tmp > $TMPDIR/dialog.tmp
+        HINT=""
+      fi
+      DTITLE=$2
+      if [ "$DOWNLOADONLY" == "on" ];then
+        DTITLE="$DTITLE (download only)"
+      fi
+
+      if $CLOGopt ; then
+        # When the user "click" the button <ChangeLog> to read the changelog of
+        # the selected pacakges, the
+        # duplicate TMPDIR/dialog.tmp so that all items are deselected to be able to
+        # regenerate the list of selected items when showChangeLogInfo() returns, ie.
+        # when the user has checked the changelog.
+
+        # When the user "clicks" the button "<ChangeLog>" to read the changelog of
+        # currently selected packages,  the dialog to select packages is terminated
+        # and the changelog is printed in a textbox.
+        #
+        # When the user exits from the textbox, the user must retrieve the packages
+        # selection dialog with the packages that were selected previously. To do that,
+        # the file $TMPDIR/dialog.tmp is duplicated with all items deselected into
+        # file $TMPDIR/dialog.tmp.off, so that the list of selected packages can
+        # be regenerated using the data in file $TMPDIR/dialog.out when
+        # showChangeLogInfos() returns.
+
+          # in case of install, dialog.tmp is to the format (1), otherwise the format (2)
+          # is used :
+          #
+          # format (1)
+          #  <pkg-name> <repository> on|off
+          # format (2)
+          #  <pkg-name> <repository> on|off <installed-version> --> <available-version>
+
+        if [ "$2" == "install" ] ; then
+                cat $TMPDIR/dialog.tmp | sed "s/ on$/ off/g" > $TMPDIR/dialog.tmp.off
+        else
+                cat $TMPDIR/dialog.tmp | sed "s/ on / off /g" > $TMPDIR/dialog.tmp.off
+        fi
+      fi
+
+      while ! $EXIT ; do
+
+        if $CLOGopt ; then
+          dialog --extra-button \
+            --extra-label "ChangeLog" \
+            --title "$DTITLE" \
+            --backtitle "slackpkg $VERSION" $HINT \
+            --checklist "Choose packages to $2:" \
+            19 70 13 \
+            --file $TMPDIR/dialog.tmp 2>$TMPDIR/dialog.out
+        else
+          dialog  --title "$DTITLE" \
+            --backtitle "slackpkg $VERSION" $HINT \
+            --checklist "Choose packages to $2:" \
+            19 70 13 \
+            --file $TMPDIR/dialog.tmp 2>$TMPDIR/dialog.out
+        fi
+
+        case $? in
+          0|1)
+            EXIT=true
+                  dialog --clear
+          ;;
+
+          3)
+            dialog --clear
+
+            if $CLOGopt ; then
+
+              if [ -s $TMPDIR/dialog.out ] ; then
+                showChangeLogInfo $TMPDIR/dialog.out
+
+                # regenerate the list of selected package from the patterns
+                # in TMPDIR/dialog.out and the file TMPDIR/dialog.tmp.off
+
+                PKGS_REGEX=$(cat $TMPDIR/dialog.out|sed "s/ /\\\|/g")
+
+                cat $TMPDIR/dialog.tmp.off > $TMPDIR/dialog.tmp
+                  # in case of install, dialog.tmp is to the format (1), otherwise the format (2)
+                  # is used :
+                  #
+                  # format (1)
+                  #  <pkg-name> <repository> on|off
+                  # format (2)
+                  #  <pkg-name> <repository> on|off <installed-version> --> <available-version>
+
+                if [ "$2" == "install" ] ; then
+                        sed -i -e "/^$PKGS_REGEX/ s= off$= on=" $TMPDIR/dialog.tmp
+                else
+                        sed -i -e "/^$PKGS_REGEX/ s= off = on =" $TMPDIR/dialog.tmp
+                fi
+
+              else
+                dialog --title "ChangeLog" --msgbox "Please, select at least one package." 5 40
+                # all packages are deselected ...
+                cat $TMPDIR/dialog.tmp.off > $TMPDIR/dialog.tmp
+              fi
+            else
+              EXIT=true
+            fi
+          ;;
+
+          -1|124|125|126|127)
+            EXIT=true
+            dialog --clear
+            echo -e "DIALOG ERROR:\n-------------" >> $TMPDIR/error.log
+            cat $TMPDIR/dialog.out >> $TMPDIR/error.log
+            echo "-------------" >> $TMPDIR/error.log
+            echo "If you want to continue using slackpkg, disable the DIALOG option in" >> $TMPDIR/error.log
+            echo "$CONF/slackpkg.conf and try again." >> $TMPDIR/error.log
+            echo "Help us to make slackpkg a better tool - report bugs to the slackpkg" >> $TMPDIR/error.log
+            echo "developers" >> $TMPDIR/error.log
+            cleanup
+          ;;
+        esac
+      done
+      echo
+      echo
+      SHOWLIST=$(cat $TMPDIR/dialog.out | tr -d \")
+      if [ -z "$SHOWLIST" ]; then
+        echo "No packages selected for $2, exiting."
+        cleanup
+      fi
+    } # END function showlist()
+  elif [ "$DIALOG" = "full" ] || [ "$DIALOG" = "FULL" ]; then
+    # Show the lists and asks if the user want to proceed with that action
+    # Return accepted list in $SHOWLIST
+    #
+    # This FULL version show - in install mode - same package from multiple repository
+    #
+    function showlist() {
+      debug $*
+      local CLOGopt=false
+      local EXIT=false
+
+      if [ "$ONOFF" != "off" ]; then
+        ONOFF=on
+      fi
+
+      if [ "$2" == "upgrade" ] || [ "$2" == "upgrade-all" ] || [ "$2" == "install" ] ; then
+        CLOGopt=true
+      fi
+
+      cat $TMPDIR/greylist.* >$TMPDIR/greylist
+      if [ "$GREYLIST" == "off" ];then
+        >$TMPDIR/greylist
+      fi
+      rm -f $TMPDIR/dialog.tmp
+     
+      if [ "$2" = "upgrade" ]; then
+        ls -1 $ROOT/var/log/packages > $TMPDIR/tmplist
+        for i in $1; do
+          TMPONOFF=$ONOFF
+          BASENAME=$(cutpkg $i)
+          PKGFOUND=$(grep -m1 -e "^${BASENAME}-[^-]\+-[^-]\+-[^-]\+$" $TMPDIR/tmplist)
+          REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') "  $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//')
+          REPOPOSFULL=$(grep -m1 " $(echo $i|sed 's/\.t.z//') "  $TMPDIR/pkglist|sed 's/SLACKPKGPLUS_//'|awk '{print $0,gensub(/([0-9]+)([^0-9]*)/,"\\1 \\2_","1",$5),$6}')
+          PKGVER=$(echo $i|rev|cut -f3 -d-|rev)
+          ALLFOUND=$(echo $(grep " ${BASENAME} " $TMPDIR/pkglist|sed -r -e 's/SLACKPKGPLUS_//' -e 's/^([^ ]*) [^ ]* ([^ ]*) [^ ]* ([^ ]*) .*/\2-\3(\1) ,/')|sed 's/,$//')
+
+          ( echo $PKGFOUND ; grep -m1 " ${BASENAME} " $TMPDIR/pkglist ) |grep -q -Ew -f $TMPDIR/greylist && TMPONOFF="off"
+          echo "$REPOPOSFULL $i \"$REPOPOS\" $TMPONOFF \"installed: $PKGFOUND  -->  available: $ALLFOUND\"" >>$TMPDIR/dialog.tmp.1
+        done
+
+        # 1    2      3      4    5 6                    7        8  9 1011                    12-
+        # repo package 1.0.12 i586 1 package-1.0.12-i586-1 ./path/to txz 1 _ package-1.0.12-i586-1 package-1.0.12-i586-1.txz "repo" on "installed: ... "
+        case "$SHOWORDER" in
+          "repository") SHOWORDER=1;;
+          "arch")      SHOWORDER=4;;
+          "package")    SHOWORDER=6;;
+          "path")      SHOWORDER=7;;
+          "tag")        SHOWORDER=10;;
+          *)            SHOWORDER=6;;
+        esac
+        cat $TMPDIR/dialog.tmp.1 | awk '{print $'$SHOWORDER',$0}'|sort|cut -f13- -d" " >$TMPDIR/dialog.tmp
+        HINT="--item-help"
+
+      else # other than 'upgrade'
+
+        echo $1
+        for i in $1; do
+#          TMPONOFF=$ONOFF
+#          REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') "  $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//')
+#          ( echo $i;grep -m1 " $(echo $i|sed 's/\.t.z//') "  $TMPDIR/pkglist ) | grep -q -Ew -f $TMPDIR/greylist && TMPONOFF="off"
+#          echo "$i \"$REPOPOS\" $TMPONOFF" >>$TMPDIR/dialog.tmp
+          TMPONOFF=$ONOFF
+          BASENAME=$(cutpkg $i)
+          PKGFOUND=$(grep -m1 -e "^${BASENAME}-[^-]\+-[^-]\+-[^-]\+$" $TMPDIR/tmplist)
+          REPOPOS=$(grep -m1 " $(echo $i|sed 's/\.t.z//') "  $TMPDIR/pkglist|awk '{print $1}'|sed 's/SLACKPKGPLUS_//')
+
+          # 1    2      3      4    5 6                    7        8
+          # repo package 1.0.12 i586 1 package-1.0.12-i586-1 ./path/to txz
+          grep " ${BASENAME} "  $TMPDIR/pkglist|sed 's/SLACKPKGPLUS_//'|awk '{
+                          printf("%s ",$0) # 1..8
+                          printf("%s ",gensub(/([0-9]+)([^0-9]*)/,"\\1 \\2_","1",$5)) # 9 10
+                          printf("%s ",$6) # 11
+                          printf("%s ",$6"."$8) # 12
+                          printf("\"%s\" ",$1) # 13
+                          if( "'$i'" == $6"."$8 && "'$REPOPOS'" == $1 ){
+                            printf("'$TMPONOFF'\n") # 14
+                          }else{
+                            printf("off\n") # 14
+                          }
+                      }'|awk '{if(!i[$12]++)print $0}' >> $TMPDIR/dialog.tmp.1
+          # 1    2      3      4    5 6                    7        8  9 1011                    12                        13    14
+          # repo package 1.0.12 i586 1 package-1.0.12-i586-1 ./path/to txz 1 _ package-1.0.12-i586-1 package-1.0.12-i586-1.txz "repo" on
+        done
+        case "$SHOWORDER" in
+          "repository") SHOWORDER=1;;
+          "arch")      SHOWORDER=4;;
+          "package")    SHOWORDER=6;;
+          "path")      SHOWORDER=7;;
+          "tag")        SHOWORDER=10;;
+          *)            SHOWORDER=6;;
+        esac
+        cat $TMPDIR/dialog.tmp.1 | awk '{print $'$SHOWORDER',$0}'|sort|cut -f13- -d" " >$TMPDIR/dialog.tmp
+
+        HINT=""
+      fi
+
      # This is needed because dialog have a limit of arguments.
      # This limit is around 20k characters in slackware 10.x
      # Empiric tests on slackware 13.0 got a limit around 139k.


zerouno 05-31-2018 03:06 AM

IMPORTANT

slackware current introduce slackpkg-2.83.0 that broke slackpkg+-1.7.0-x86_64-5mt

You should upgrade to slackpkg+-1.7.0-x86_64-6mt BEFORE upgrade slackpkg, otherwise you need to upgrade it by downloading it manually.

(slackpkg+ development release already works with slackpkg-2.83)

Code:

Thu May 31 09:39:12 CEST 2018
pkg/slackpkg+-1.7.0-noarch-6mt.txz: Rebuilt
  - It works with the newest slackpkg-2.83.0; it broke something about the
    $ROOT feature. Slackpkg+ stable will work only if $ROOT is not set.
    IMPORTANT!!! this slackpkg+ version also broke the $ROOT feature in
    slackware-current! If you need it do not upgrade slackpkg+!!!

It is an emergency release.
It broke the $ROOT compatibility even in slackpkg-2.82.2
If you use slackware-stable and need $ROOT do NOT upgrade slackpkg+
This is a workaround. I will work for a better fix when I'll a lot of time.

ahlr 05-31-2018 06:26 AM

Upgrade manually slackpkg+: http://www.slakfinder.org/slackpkg+/pkg/

majekw 06-05-2018 02:52 PM

I think it broke more than $ROOT.
I installed new Slackpkg+ on 14.2, I have "TAG_PRIORITY=on" and "PKGS_PRIORITY=( multilib: )" set.
New version ignored it altogether offering me to upgrade bunch of multilib, SBo and my custom packages with original Slackware versions.

zerouno 06-05-2018 06:33 PM

the correct syntax is
PKGS_PRIORITY=( multilib )
or
PKGS_PRIORITY=( multilib:.* )

and tell me if it works

however if slackpkg+-1.7.0-noarch-5mt did work with ( multilib: ) I need to investigate (but I use slackware-current).

You can find the older versions here: http://slakfinder.org/slackpkg+all/
(do not use the older version with slackware-current)


All times are GMT -5. The time now is 11:45 AM.