-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android/Termux doesn't have flock, see yt-dlp solution #496
Comments
Redirecting to filelock dependency. |
Actually, regardless of the filelock dependency, this problem exists, and should be addressed. Test if the system can create a file lock, catch the exception, if exception, try a soft file lock, if soft file lock fails, just don't lock. This should not be causing an error. If the filelock lib fixes this, update dependency requirement and remove code. |
Possibly fixed in v2.12.1, can you see if it works on your system? |
Works for me now. Much appreciated workaround. Can leave open for a bit if anyone else wants to verify. |
Got this error even in v.2.12.1
|
It DID work for me, and now it DOES NOT. Not sure what else changed. |
@7x11x13
|
TL;DR: Will ONLY work inside app data portion of filesystem ( Arguably filelock lib should test and return softlock instead, but it doesn't, and probably won't. As previously stated, yt-dlp suffers no problem as they test first. scdl must test first before assuming a hard lock will work. The hard lock does no magic, any program is free to ignore "locks". Not much semantic difference with soft locks. IIUC Neither is thread safe. Both can suffer race conditions. A basic test case to see the error in Termux:
~/foo.py:
|
Might be fixed in v2.12.2 |
Still works in the app data area. No error given but silent failure and no file creation in shared/sdcard area. In shared/sdcard area
The object id varies between runs. As initially mentioned, need to gracefully degrade, by testing if we can lock, if not, test a soft lock, if not, then no lock. |
I believe the only reason acquiring the SoftFileLock fails is either not having write permissions in the place where you're trying to download the song, or that a previous SoftFileLock was created there and it thinks another process is downloading the song there. Can you check if there are any lingering .scdl.lock files? BTW, in the meantime I would recommend switching to yt-dlp. I'm pretty sure it can do everything this script can with some configuration. I'm planning to update this script so it's just a yt-dlp wrapper in the future so I don't have to maintain it anymore. |
I have write permissions, can use shell echo and redirect, vim, wget, yt-dlp, and other programs, including C, Node.js, Python, to create and modify files inside Termux, as well as create and modify documents in other Android apps, or create, rename, copy, move, or delete files in various file managers, all in this Music directory. The only restriction I was aware of was execute permission. There were no temporary lock files or other cruft left behind in this directory. I ran an strace. After the
Anyways, fair enough to let yt-dlp handle this. In the past, I don't think it did. Not sure when support was added. It's always nice to have options. But I understand. Thanks for the efforts. Regards. |
TL;DR filelock dependency issue?
Same issue as listed on yt-dlp.
Android/Termux doesn't have flock.
Fallback to lockf.
Possibly fallback to no lock.
The text was updated successfully, but these errors were encountered: