nega0 / pianobarfly

pandora2[mp3|m4a]
https://github.com/nega0/pianobarfly
Other
62 stars 31 forks source link

Error overwriting the MP4 file (18:Invalid cross-device link). #43

Closed copocaneta closed 11 years ago

copocaneta commented 11 years ago

Hello there,

Could somebody please help me out with this error?

I am using Ubuntu 12.04 LTS.

I get the following error whenever pianobarfly (master branch) tries to add the id3tag to the audio file between one audio track and another:

|> "Davey Jones Locker" by "Pepper" on "Pink Crustaceans And Good Vibrations" /!\ Error overwriting the MP4 file (18:Invalid cross-device link). /!\ Error writing the tag to the file (Pepper/Pink_Crustaceans_And_Good_Vibrations/Pepper-Davey_Jones_Locker.m4a).

So I looked up on this error and I saw some people suggesting the use of the develop branch. I understood this happens because of /tmp folder being on a different filesystem than the audio files. My audio files are being recorded to the following path: ./mp3

This is how my config file looks like:

user = user password = password control_proxy = http://IP:PORT/ history = 20 audio_file_dir = ./mp3 audio_quality = high

(I am using a proxy because I am outside the US).

In order to run the develop branch I had to take the audio_quality var out of the config file, otherwise I would get "(i) Login... Network error: Timeout.".

I tried with the DEVELOP branch and I get another error, this time right after receiving the playlist and before playing the first song:

|> Station "Sublime Radio" (1135921372068795883) (i) Receiving new playlist... Ok. |> "Yellow Ledbetter" by "Pearl Jam" on "Rearviewmirror (Greatest Hits 1991-2003)" Segmentation fault (core dumped)

Aditional info:

$ mount -l /dev/sda5 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) /home/myuser/.Private on /home/myuser type ecryptfs (key) gvfs-fuse-daemon on /home/myuser/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=myuser) /dev/sdb1 on /media/Elements type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096) [Elements]

Any help is highly apreciated. Thanks in advance.

ghost commented 11 years ago

I get the same error.

Also there seems to be an occasional bug handling some strings? See the name of the album here, it says "]":

|> "Chronicle A Free Subletting" by "Pretendo" on "]" /!\ Error overwriting the MP4 file (18:Invalid cross-device link). /!\ Error writing the tag to the file (Pretendo/]/Pretendo-Chronicle A Free Subletting.m4a).

It created the file: /home/bkw/tunes/Pretendo/]/Pretendo-Chronicle A Free Subletting.m4a

But the album is really named "Pretendo ][" http://www.amazon.com/Pretendo-II/dp/B0013GE42K/ref=sr_shvl_album_1?ie=UTF8&qid=1356665059&sr=301-1

Anyway back to the id3tag error:

|> "Crutch" by "Pinback" on "Pinback" /!\ Error overwriting the MP4 file (18:Invalid cross-device link). /!\ Error writing the tag to the file (Pinback/Pinback/Pinback-Crutch.m4a).

/home is on the same as /, namely /dev/sda1, aka my laptops ssd. /tmp is tmpfs

Just to rule out the obvious, there is plenty of available ram for the tmpfs /tmp. 2G of ram, 1.3G available. It's a netbook running Bodhi Linux which is a very minimal distro, no gnome, no kde, no pulseaudio, etc.

root@noexcuse:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 28G 5.0G 22G 19% / tmpfs 1004M 264K 1004M 1% /tmp [...]

root@noexcuse:~# free -h total used free shared buffers cached Mem: 2.0G 1.7G 237M 0B 160M 974M -/+ buffers/cache: 634M 1.3G Swap: 0B 0B 0B

ghost commented 11 years ago

FIXED thanks mostly to https://github.com/silentcontender/patches/blob/master/pianobarfly/tmpfs_fix.diff

That patch has 2 major but simple to fix bugs.

[ update ] One is just that an open() call was missing necessary arguments, the other was that it was never deleting the temp files for the cases when it had to use send() file, so, pretty bad, you tmpf fills right up. Both trivial to fix.

I had a fixed version of that patch up here originally but now see below instead, it's much simpler.

ghost commented 11 years ago

I made a much simpler fix.

Instead of using tmpnam() which uses /tmp, just copy the mp3/m4a output file name and add a couple characters to it to make a temp file guaranteed always on the same filesystem as the destination. Then we can just use the original simple rename() to do both jobs at once, writing the new output and deleting the temp file.

https://github.com/aljex/misc/blob/master/pianobarfly/tmp_path_fix.diff

jness commented 11 years ago

Worked like a charm! Thanks.

brijam commented 11 years ago

This issue has existed in the master branch for over a year: https://github.com/ghuntley/pianobarfly/issues/19

Thanks for the fix. It also worked for me. I hope it gets accepted into master.