Git Product home page Git Product logo

Comments (10)

panzi avatar panzi commented on September 27, 2024 1

Very weird that sendfile() doesn't work! That should be a very fast way to copy files. I've added an option --no-sendfile to unpack now so one can use it when sendfile doesn't work for some reason.

from u4pak.

panzi avatar panzi commented on September 27, 2024

Is this really the whole error message an no stack trace is printed? Would be good to know what source line (syscall) is actually causing that error.

from u4pak.

Tobe95 avatar Tobe95 commented on September 27, 2024

Thanks for getting back to me so quickly, unfortunately that's the only thing the terminal is putting out. I'm not a linux beginner but also by no means an expert. I've run 'ltrace -S python' with the script and it has given me a really long output, that's basically just the end of it:

SYS_ioctl(1, 0x5413, 0x7ffd270ae528, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aebc8, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aebc8, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aebc8, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aebc8, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aea38, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aea38, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270ae8a8, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aea38, 0x6dbbf7) = 0
SYS_ioctl(1, 0x5413, 0x7ffd270aea38, 0x6dbbf7) = 0
SYS_openat(0xffffff9c, 0x7f10b74a3b50, 0x80000, 0) = 3
SYS_fstat(3, 0x7ffd270af240) = 0
SYS_ioctl(3, 0x5401, 0x7ffd270af2b0, 0x7ffd270af3e0) = -25
SYS_lseek(3, 0, 1) = 0
SYS_lseek(3, -44, 2) = 163688
SYS_lseek(3, 0, 1) = 163688
SYS_read(3, "\341\022oZ\003", 4096) = 44
SYS_lseek(3, 163087, 0) = 163087
SYS_read(3, "\n", 4096) = 645
SYS_lseek(3, 0, 1) = 163732
SYS_stat("./Engine/Config/Switch", 0x7ffd270aee10) = 0
SYS_openat(0xffffff9c, 0x7f10b74a9e90, 0x80241, 438) = 4
SYS_fstat(4, 0x7ffd270aed00) = 0
SYS_ioctl(4, 0x5401, 0x7ffd270aed70, 0x7ffd270aeea0) = -25
SYS_lseek(4, 0, 1) = 0
sendfile64(4, 3, 0x7ffd270aece8, 0x356e <unfinished ...>
SYS_sendfile(4, 3, 0x7ffd270aece8, 0x356e) = -22
<... sendfile64 resumed> ) = -1
SYS_close(4) = 0
SYS_close(3) = 0
write(2, "[Errno 22] Invalid argument\n", 28 <unfinished ...>
SYS_write(2, "[Errno 22] Invalid argument\n", 28[Errno 22] Invalid argument
) = 28
<... write resumed> ) = 28
fflush(0x7f10b84ed6a0) = 0
SYS_rt_sigaction(2, 0x7ffd270af840, 0x7ffd270af8e0, 8) = 0
SYS_sigaltstack(0, 0x7ffd270afad0) = 0
SYS_sigaltstack(0x95bcd0, 0) = 0
pthread_key_delete(0, 0x7f10b7aefb80, 1, 0xd1ea50) = 0
exit(1 <unfinished ...>
SYS_exit_group(1 <no return ...>
+++ exited (status 1) +++

Would this be of any use?

from u4pak.

panzi avatar panzi commented on September 27, 2024

from u4pak.

Tobe95 avatar Tobe95 commented on September 27, 2024

No problem. Unfortunately I don't have any Python knowledge so I guess this will have to wait. Maybe somebody else with the same issue might be able to solve it...

from u4pak.

panzi avatar panzi commented on September 27, 2024

Change the last few lines from the Python script from this:

if __name__ == '__main__':
	try:
		main(sys.argv[1:])
	except (ValueError, NotImplementedError, IOError) as exc:
		sys.stderr.write("%s\n" % exc)
		sys.exit(1)

To this:

if __name__ == '__main__':
	main(sys.argv[1:])

And then show me the new output. 😄

from u4pak.

Tobe95 avatar Tobe95 commented on September 27, 2024

Cheers, this is the output I'm getting now:

Traceback (most recent call last):
File "/home/tobi/Desktop/u4pak-master/u4pak (copy).py", line 1875, in
main(sys.argv[1:])
File "/home/tobi/Desktop/u4pak-master/u4pak (copy).py", line 1802, in main
pak.unpack(stream, args.dir, unpack_callback)
File "/home/tobi/Desktop/u4pak-master/u4pak (copy).py", line 311, in unpack
record.unpack(stream, outdir, callback)
File "/home/tobi/Desktop/u4pak-master/u4pak (copy).py", line 540, in unpack
self.sendfile(fp, stream)
File "/home/tobi/Desktop/u4pak-master/u4pak (copy).py", line 469, in sendfile
sendfile(outfile, infile, self.data_offset, self.uncompressed_size)
File "/home/tobi/Desktop/u4pak-master/u4pak (copy).py", line 80, in sendfile
os.sendfile(out_fd, in_fd, offset, size)
OSError: [Errno 22] Invalid argument

from u4pak.

panzi avatar panzi commented on September 27, 2024

Well, this is weird. What filesystem are you using? What happens if you add this line before the if __name__ == '__main__':?

sendfile = highlevel_sendfile

from u4pak.

Tobe95 avatar Tobe95 commented on September 27, 2024

Thank you so much, that solved my issue! No error message and the script extracted all the files. I'm using ext4 though my home partition is on a separate hard drive, not sure if this could have been an issue? It still appears strange to me that it was working some months ago since it's the same machine and I just did some updates since, but anyways it's working 😄

from u4pak.

panzi avatar panzi commented on September 27, 2024

I'm using ext4 though my home partition is on a separate hard drive, not sure if this could have been an issue?

At first I thought maybe sendfile doesn't work cross-filesystem, but in a local test it worked for me, and it doesn't make sense that it wouldn't work anyway, since it originates from piping a file to a socket (i.e. definitely not the same filesystem). Really weird why it didn't work. Looking at the manpage this is the only thing that might be the case to cause EINVAL:

an mmap(2)-like operation is not available for in_fd

But why should that be the case for your filesystem? The other options:

Descriptor is not valid

Can't be, it just was opened before. If it's not valid Python would raise an exception before it gets to that point.

or locked

That would be weird. Is your file locked somehow? But then other normal read wouldn't work either, I think.

or count is negative.

Can't be, I even check count > 0 before.

out_fd has the O_APPEND flag set.

I don't set that flag.

So strange.

from u4pak.

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.