Menu

#236 unzip problem

v1.0_(example)
closed-fixed
nobody
unzip (1) bug (4)
5
2024-01-03
2019-01-06
Peter
No

Xfe 1.43.1 on FreeBSD 11.1 (installed from package).
The same problem is present in Xfe 1.43.1 compiled from sources.
The program blocks completely (need to kill -9) after unzipping files.
It seems that the problem is that unzip tool does not put anything in stdout if unzipping is successful, so CommandWindow::onWatchProcess does not read correctly the pipes related to stdout/stderr.
A workaround is to modify FilePanel.cpp to change the command line for unzipping from "unzip -o " to "7z x -y " (like for 7z archives). Probably, the CommandWindow::onWatchProcess needs to be modified to handle correctly null output of unzip tool.

Discussion

  • Roland Baudin

    Roland Baudin - 2019-06-08

    I'll try to test Xfe in a FreeBSD virtual machine but suince I never used this system, this could be tricky for me... Do you have some instructions about how to compile Xfe in FreeBSD?

     
  • Peter

    Peter - 2019-06-19

    There is nothing special in building XFE on FreeBSD.
    ./configure --enable-release --enable-threads=posix; make; sudo make install

     
    • Roland Baudin

      Roland Baudin - 2019-06-19

      Yes I can imagine that, but how do you go to the point you could compile Xfe in FreeBSD?

      Indeed, I tried to install FreeBSD in a virtual machine and all I got is a console system (no X Window)...

      How do you install X Window, the Gnome desktop (or XFCE) and all the required libraries and dependencies needed to compile Xfe?

       

      Last edit: Roland Baudin 2019-06-19
  • Peter

    Peter - 2019-06-19

    Ah, OK, I understand better the question :)
    Indeed, there is no X by default installed in FreeBSD: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/x11.html
    The fastest way to get a DE installed - install lxde-meta package:
    pkg install lxde-meta
    Then you need to add exec startlxde in ~/.xinitrc and LXDE will be started on startx command.

     
  • Roland Baudin

    Roland Baudin - 2019-06-19

    OK, I'll look to it. And for the required libraries and tools needed to build Xfe, is there some 'build-essentials' package to install?

     
  • Peter

    Peter - 2019-06-19

    You can install the package for XFE pkg install xfe and then remove it pkg delete xfe Like this you will have all the necessary libs installed. As about build itself - probably you need to install GNU make (if FreeBSD make does not work for your makefile - so you use gmake and not make to build XFE) and autotools pkg install gmake autotools

     
  • Roland Baudin

    Roland Baudin - 2019-06-20

    OK, thanks for the tips. I'll do this and try to fix those bugs related to FreeBSD...

     

    Last edit: Roland Baudin 2019-06-20
  • Peter

    Peter - 2019-11-04

    Any news about this bug? Just upgraded to 1.43.2 - the same thing...

     
  • Roland Baudin

    Roland Baudin - 2021-03-14
    • status: open --> closed-fixed
     
  • Roland Baudin

    Roland Baudin - 2021-03-14

    Fixed in Xfe 1.44

     
  • Peter

    Peter - 2023-01-09

    The problem is still present in xfe 1.45 (both installed from package and compiled from source).
    In FilePanel.cpp:5159 unzipping is configured as follows:

            else if (ext1 == "zip")
            {
                cmd = "unzip -o ";
            }
    

    The default unzip installed in base as /usr/bin/unzip does not produce any output with -o option, so any unzipping blocks completely the Xfe program. I suggest using 7z to manage zip files (and add it to dependencies list of Xfe port) as there is no option to show files extracted with unzip -o command on FreeBSD.

     
  • Roland Baudin

    Roland Baudin - 2023-01-15
    • status: closed-fixed --> pending
     
  • Roland Baudin

    Roland Baudin - 2023-01-15

    I can't reproduce the bug. I installed FreeBSD 13.1 in a virtual machine and I can extract a .zip archive without blocking Xfe. The only issue I see is that 'unzip -o' does not produce any output, which is normal on this system.

    In Linux (Ubuntu 22.04), I replaced 'unzip -o' with 'unzip -qo' to force no output like in the FreeBSD case. Once again, unzipping with Xfe is OK (with no output of course).

    So, to me, everything seems OK.

     
  • Peter

    Peter - 2023-01-15

    I can't reproduce the bug. I installed FreeBSD 13.1 in a virtual machine and I can extract a .zip archive without blocking Xfe.

    Hmm, it's really strange. Did you try all the three options - 'Extract here', 'Extract to folder <filename>' and 'Extract to...'? Does Xfe correctly works for you, being installed from package (pkg install xfe)?
    I'll try to revert my changes and debug your 'vanilla' version to get more information. Maybe my old diag is not correct anymore.</filename>

     
  • Peter

    Peter - 2023-01-16

    I've rebuilt your 'vanilla' version. It blocks completely on 'Extract to folder <filename>'. I attached GDB - there is only one thread, the backtrace is as follows:</filename>

    (gdb) info threads
      Id   Target Id                  Frame
    * 1    LWP 109363 of process 8190 0x0000000800ca46b8 in _read () from /lib/libc.so.7
    (gdb) bt
    #0  0x0000000800ca46b8 in _read () from /lib/libc.so.7
    #1  0x0000000800fc2856 in ?? () from /lib/libthr.so.3
    #2  0x00000000002ad6e4 in CommandWindow::onWatchProcess(FX::FXObject*, unsigned int, void*) ()
    #3  0x00000008006c1f39 in FX::FXObject::tryHandle(FX::FXObject*, unsigned int, void*) () from /usr/local/lib/libFOX-1.6.so.0
    #4  0x000000000032f08f in FX::FXApp::getNextEvent(_XEvent&, bool) ()
    #5  0x000000080061e0aa in FX::FXApp::run() () from /usr/local/lib/libFOX-1.6.so.0
    #6  0x000000000033dfbf in main ()
    

    If you want more debugs - please, give me more detailed instructions.

     
  • Peter

    Peter - 2023-01-16

    I confirm that the program is blocked at CommandWindow.cpp:279 waiting for data from the finished child process.

     
  • Peter

    Peter - 2023-01-16

    The following patch fixed it for me (I just added O_NONBLOCK to the pipe) :

    --- CommandWindow.cpp.orig  2022-12-23 12:05:51.000000000 +0100
    +++ CommandWindow.cpp   2023-01-16 18:46:11.386578000 +0100
    @@ -276,17 +276,25 @@
         {
             // Child has finished.
             // Read data from the finished child
    -        while ((nread = read(pipes[0], buf, sizeof(buf) - 1)) > 0)
    +        int pflags;
    +        if ((pflags = fcntl(pipes[0], F_GETFL)) >= 0)
             {
    -            buf[nread] = '\0';
    -            // Remove backspace characters, if any
    -            FXString strbuf = buf;
    -            strbuf = strbuf.substitute("\b", ".");
    -            text->appendText(strbuf.text(), strlen(strbuf.text()));
    -            scrollToLastLine();
    -            if (nread < (int)(sizeof(buf) - 1))
    +            pflags |= O_NONBLOCK;
    +            if (fcntl(pipes[0], F_SETFL, pflags) >= 0)
                 {
    -                break;
    +                while ((nread = read(pipes[0], buf, sizeof(buf) - 1)) > 0)
    +                {
    +                    buf[nread] = '\0';
    +                    // Remove backspace characters, if any
    +                    FXString strbuf = buf;
    +                    strbuf = strbuf.substitute("\b", ".");
    +                    text->appendText(strbuf.text(), strlen(strbuf.text()));
    +                    scrollToLastLine();
    +                    if (nread < (int)(sizeof(buf) - 1))
    +                    {
    +                       break;
    +                    }
    +                }
                 }
             }
             if (killed)
    
     
  • Roland Baudin

    Roland Baudin - 2023-01-17

    OK, thanks, I'll do the change you propose.

     

    Last edit: Roland Baudin 2023-01-17
    • Peter

      Peter - 2023-11-21

      Any news? The problem is still present, the patch still solves it...

       
  • Peter

    Peter - 2023-01-17

    https://www.freshports.org/x11-fm/xfe/
    In the section 'Dependencies' you can see all ports/packages needed by xfe on FreeBSD for build and for run.

     
    • Roland Baudin

      Roland Baudin - 2023-01-21

      I did not succeed to build Xfe on FreeBSD, but I trust you and your fix will be in the next release. Thanks.

       
  • Peter

    Peter - 2023-01-21

    I would like to help you to build it. What is the problem?
    If you give me a (readonly) access to a Git repository of Xfe - I can create a Jenkins job to build it daily in a FreeBSD jail.
    You can contact me using my email peter on flytrace dot com.

     
    • Roland Baudin

      Roland Baudin - 2023-01-21

      There are many problems: first, FreeBSD doesn't work well in kvm / qemu. Then, the compiler is not found, and so on... So I give up for now. Thanks for your offer, but if Xfe works for you, that's OK for me right now.

       
  • Roland Baudin

    Roland Baudin - 2024-01-03

    OK, thanks a lot. Your patch is applied to Xfe 1.46.

     
  • Roland Baudin

    Roland Baudin - 2024-01-03
    • status: pending --> closed-fixed
     

Log in to post a comment.