Giter VIP home page Giter VIP logo

Comments (14)

ib avatar ib commented on August 23, 2024

Which archive type are you trying to open?
Which OpenBSD program is responsible for opening it (xarchiver -i)?

Or an error condition is not handled ?

Depending on how OpenBSD behaves that likely might be.

I can provide you with patches to track that issue down, if you are willing to assist.

On top of this i'd remove the 3 occurences of

while (gtk_events_pending())
              gtk_main_iteration();

This allows handling GTK events while the command line background processes are running.

from xarchiver.

landryb avatar landryb commented on August 23, 2024

It happens whatever archive type i try to open, zip or tgz here. tracing with gdb, it seems there are race conditions in xa_process_stdout/xa_process_stderr, and gio keeps calling them with cond=G_IO_IN (so there is data to read) but the lines are all empty. I tried adding some handling for status=G_IO_STATUS_EOF (ie shutting down the gio channel) but failed to have something reliable, it's as if output/stderr lines were in a random order.

It seems on OpenBSD, gio first calls xa_process_stdout, status ie EOF, line is null, then i get the lines data so status is G_IO_STATUS_NORMAL (but sometimes not all of them), and then and endless loop of calls with G_IO_IN but g_io_channel_read_line() keeps returning EOF.

I can test patches of course, but i'm pretty sure if you try it in a VM you'll quickly reproduce it :)

The archivers detection works fine.

$./src/xarchiver -i                                                                                                                                   
xarchiver 0.5.4 ©  2005-2014 Giuseppe Torelli
xarchiver 0.5.4.12 Ingo Brückl
7zip:
  /usr/local/bin/7z
arj:
  /usr/local/bin/7z -tarj
bzip2:
  /usr/local/bin/bzip2
compress:
  /usr/bin/compress
cpio:
  /bin/cpio
deb:
  /usr/bin/ar
gzip:
  /usr/bin/gzip
lha:
  /usr/local/bin/7z -tlzh
lz4:
  /usr/local/bin/lz4
lzma:
  /usr/local/bin/lzma
rar, rar5:
  /usr/local/bin/7z -trar
  /usr/local/bin/7z -trar5
rpm:
  /bin/cpio
tar:
  /usr/local/bin/gtar
xz:
  /usr/local/bin/xz
zip, epub, jar, oxt, xpi:
  /usr/local/bin/unzip
  /usr/local/bin/zip

from xarchiver.

ib avatar ib commented on August 23, 2024

it's as if output/stderr lines were in a random order

They are.

I can test patches of course, but i'm pretty sure if you try it in a VM you'll quickly reproduce it :)

I could, if I had a VM. :)

Please apply the attached patch, unset "Store archiver output" and redirect stderr to a log file when calling xarchiver. Please open something simple, like this attachment.

Hopefully, I'll get an idea from it.

[issue47.zip]

from xarchiver.

landryb avatar landryb commented on August 23, 2024

Well, i more or less had a similar local diff, and here's what it does:

# command: [/usr/local/bin/unzip -Z -l /tmp/mozilla_landry0/issue47.zip]
# creating channels...
# spawning done.
# [Archive:  /tmp/mozilla_landry0/issue47.zip] read from stdout (1)
# status is normal, interating... 

(xarchiver:40175): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed
# [(null)] read from stderr (2)

(xarchiver:40175): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed
# [(null)] read from stderr (2)

(xarchiver:40175): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed
# [(null)] read from stderr (2)

And then it goes in an infinite loop, for some reason gio keeps telling there's data to read on stderr.

Fwiw it's easy to build an OpenBSD vm in virtualbox, you only need maybe 2 or 3Go to install X and xarchiver dependencies :)

from xarchiver.

ib avatar ib commented on August 23, 2024

And then it goes in an infinite loop, for some reason gio keeps telling there's data to read on stderr.

Let's figure out what it is telling else. (New patch to be applied on fresh master checkout.)

[issue47.zip]

Fwiw it's easy to build an OpenBSD vm in virtualbox

Yeah, but there's plenty of other stuff to be done.

from xarchiver.

landryb avatar landryb commented on August 23, 2024
# command: [/usr/local/bin/unzip -Z -l /tmp/issue47.zip]
# creating channels...
# spawning done.
# watching stdout (0x11)
# [Archive:  /tmp/issue47.zip] read from stdout (1)
# status is normal, interating... 
# watching stderr (0x11)
# [nothing] read from stderr (2)
# watching stderr (0x11)
# [nothing] read from stderr (2)
# watching stderr (0x11)
# [nothing] read from stderr (2)
# watching stderr (0x11)
# [nothing] read from stderr (2)
# watching stderr (0x11)

If i comment out the stderr gio watcher creation, the same infinite loop happens on stdout:

# command: [/usr/local/bin/unzip -Z -l /tmp/issue47.zip]
# creating channels...
# spawning done.
# watching stdout (0x11)
# [Archive:  /tmp/issue47.zip] read from stdout (1)
# status is normal, interating... 
# child exited, status is 0 (1)
# process 0 ended: success
# watching stdout (0x11)
# [Zip file size: 1494 bytes, number of entries: 1] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [-rw-r-----  3.0 unx     4148 tx     1318 defX 18-Feb-11 20:59 issue47.patch] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [1 file, 4148 bytes uncompressed, 1318 bytes compressed:  68.2%] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [nothing] read from stdout (2)
# watching stdout (0x11)
# [nothing] read from stdout (2)
# watching stdout (0x11)
# [nothing] read from stdout (2)
# watching stdout (0x11)

from xarchiver.

ib avatar ib commented on August 23, 2024

Thanks, I think I know now what's happening. A fix will follow in a few minutes.

from xarchiver.

ib avatar ib commented on August 23, 2024

New patch to be applied on fresh master checkout. This should fix it. (Please provide log for me to check.)

[issue47.zip]

from xarchiver.

landryb avatar landryb commented on August 23, 2024

It is definitely better as it doesnt go into an infinite loop, but i get an error window "an error occurred while accessing the archive" and the archive content isnt listed in the UI. We're getting there :)

$./src/xarchiver /tmp/issue47.zip 2>&1 |tee /tmp/xarchiver.log
# command: [/usr/local/bin/unzip -Z -l /tmp/issue47.zip]
# creating channels...
# spawning done.
# watching stdout (0x11)
# [Archive:  /tmp/issue47.zip] read from stdout (1)
# status is normal, interating... 
# watching stderr (0x11)
# [nothing] read from stderr (2)
# no more stderr input, condition is 0x11
# process 2 ended: ERROR
# child exited, status is 0 (1)
# process 0 ended: success
# watching stdout (0x11)
# [Zip file size: 1547 bytes, number of entries: 1] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [-rw-r-----  3.0 unx     4579 tx     1371 defX 18-Feb-12 10:50 issue47.patch] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [1 file, 4579 bytes uncompressed, 1371 bytes compressed:  70.1%] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [nothing] read from stdout (2)
# no more stdout input, condition is 0x11
# process 1 ended: ERROR

from xarchiver.

ib avatar ib commented on August 23, 2024

It is definitely better as it doesnt go into an infinite loop

Sorry, but I've updated my comment and exchanged the patch while you were testing. Please get it again.

from xarchiver.

landryb avatar landryb commented on August 23, 2024

I see the change with the test on cond. With that latest patch, it seems much better, except the last character of a line output seems eaten, ie the zip containing 'issue47.patch' displays the file as 'issue47.patc', and if i try to right-click -> view it, it will fail to find it in the zip.

# command: [/usr/local/bin/unzip -Z -l /tmp/issue47.zip]
# creating channels...
# spawning done.
# watching stdout (0x11)
# [Archive:  /tmp/issue47.zip] read from stdout (1)
# status is normal, interating... 
# watching stderr (0x11)
# [nothing] read from stderr (2)
# no more stderr input, condition is 0x10
# process 2 ended: success
# child exited, status is 0 (1)
# process 0 ended: success
# watching stdout (0x11)
# [Zip file size: 1547 bytes, number of entries: 1] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [-rw-r-----  3.0 unx     4579 tx     1371 defX 18-Feb-12 10:50 issue47.patch] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [1 file, 4579 bytes uncompressed, 1371 bytes compressed:  70.1%] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [nothing] read from stdout (2)
# no more stdout input, condition is 0x10
# process 1 ended: success
# command: [/usr/local/bin/unzip -j -o /tmp/issue47.zip 'issue47.patc' -d /tmp/xa-SO8EEZ]
# creating channels...
# spawning done.
# watching stdout (0x1)
# [Archive:  /tmp/issue47.zip] read from stdout (1)
# status is normal, interating... 
# watching stderr (0x1)
# [caution: filename not matched:  issue47.patc] read from stderr (1)
# status is normal, collecting... 
# watching stderr (0x11)
# [nothing] read from stderr (2)
# no more stderr input, condition is 0x10
# process 2 ended: success
# watching stdout (0x11)
# [nothing] read from stdout (2)
# no more stdout input, condition is 0x10
# process 1 ended: success
# process 0 ended: ERROR

same thing if i open a tar.gz containing a dir named py-qwt/pkg, the ui will display two dirs, one with py-qw and the other with py-qwt, containing a dir with pk and a dir with pkg, etc etc

# command: [sh -c "/usr/bin/gzip -d '/home/landry/py-qwt-5.2.1.tgz' -c > xa-tmp.decompressed"]
# creating channels...
# spawning done.
# watching stdout (0x11)
# [nothing] read from stdout (2)
# no more stdout input, condition is 0x10
# process 1 ended: success
# watching stderr (0x11)
# [nothing] read from stderr (2)
# no more stderr input, condition is 0x10
# process 2 ended: success
# process 0 ended: success
# command: [/usr/local/bin/gtar -tvf '/tmp/xa-BJ8CEZ/xa-tmp.decompressed']
# creating channels...
# spawning done.
# watching stdout (0x11)
# [drwxr-xr-x landry/wsrc       0 2017-07-26 14:27 py-qwt] read from stdout (1)
# status is normal, interating... 
# watching stderr (0x11)
# [nothing] read from stderr (2)
# no more stderr input, condition is 0x10
# process 2 ended: success
# child exited, status is 0 (1)
# process 0 ended: success
# watching stdout (0x11)
# [-rw-r--r-- landry/wsrc     687 2017-07-26 14:23 py-qwt/Makefile] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [-rw-r--r-- landry/wsrc     128 2017-07-26 13:31 py-qwt/distinfo] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [drwxr-xr-x landry/wsrc       0 2017-07-26 14:27 py-qwt/pkg] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [-rw-r--r-- landry/wsrc    3899 2017-07-26 13:51 py-qwt/pkg/PLIST] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [-rw-r--r-- landry/wsrc     288 2017-07-26 14:19 py-qwt/pkg/DESCR] read from stdout (1)
# status is normal, interating... 
# watching stdout (0x11)
# [nothing] read from stdout (2)
# no more stdout input, condition is 0x10
# process 1 ended: success

but id say that's a different/separate issue than the hangs :)

from xarchiver.

landryb avatar landryb commented on August 23, 2024

much better if i remove the g_strchomp() call from the printf debugging lines, all is fine.

from xarchiver.

ib avatar ib commented on August 23, 2024

With that latest patch, it seems much better, except the last character of a line output seems eaten

:)
That's because of the debugging output and expected behavior.

The commit will follow.

from xarchiver.

landryb avatar landryb commented on August 23, 2024

Thanks, current master works fine now on OpenBSD !

from xarchiver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.