beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.94k stars 1.82k forks source link

`reflink: auto` makes `convert` plugin crash on btrfs #5484

Open TheLastGimbus opened 4 weeks ago

TheLastGimbus commented 4 weeks ago

Problem

There seems to be problem with reflink and convert because it uses /tmp where it's not necessary the same actual btrfs filesystem

I wanted to convert all my files to .opus on import. I have btrfs, so of course i wanted to use reflink goodies

Documentation said that reflink: auto will use reflink if filesystem supports it. However, i have a feeling like there is some global flag ala:

if options['reflink'] == 'auto' and fs in ['btrfs', ...]:
    useReflinks = True  # now it will *always* do cp --reflink=always ...

because when all my imported files where done encoding:

...
convert: Finished encoding /home/matiii/Downloads/1-800-OŚWIECENIE/23 Niedziela.opus
convert: Finished encoding /home/matiii/Downloads/1-800-OŚWIECENIE/25 Main Stage Freestyle.opus
Error: OS/filesystem does not support reflinks. during link of paths /tmp/tmpofeiyiwv.opus, /home/matiii/Music/beets/Taco Hemingway/1‐800‐OŚWIECENIE/01 #1 – WIELKOMIEJSKA BEZSENNOŚĆ.opus
matiii@matiii $

This will also happen if i manually do:

cp --reflink /tmp/tmpofeiyiwv.opus /home/matiii/Music/beets/Taco\ Hemingway/1‐800‐OŚWIECENIE/bez.opus
cp: failed to clone '/home/matiii/Music/beets/Taco Hemingway/1‐800‐OŚWIECENIE/bez.opus' from '/tmp/tmpofeiyiwv.opus': Invalid cross-device link
# or:
cp --reflink=always ... # same error

seems like my /tmp/ may be in-ram or something (i didn't customize it in fstab or anything :shrug:)

When i do:

cp --reflink=auto /tmp/tmpofeiyiwv.opus /home/matiii/Music/beets/Taco\ Hemingway/1‐800‐OŚWIECENIE/bez.opus
matiii@matiii $ # works well!

Setup

My configuration (output of beet config) is:

import:
  write: yes
  move: no
  reflink: auto
  autotag: yes

...

convert:
  auto: yes
  max_bitrate: 96
  format: opus
TheLastGimbus commented 4 weeks ago

this fascinated me enought to start digging, so i git pulled, ran it, and... it worked... god damn it... i hate it when stuff works...

Then, investigating further, i found that i'm not actually using 1.6.1, but 2.0.0 perfeclty before versions strings were corrected

There is an issue about it on arch gitlab: https://gitlab.archlinux.org/archlinux/packaging/packages/beets/-/issues/4

Solution proposed is to make v2.0.1... which would be nice, because it would also merge patches from 33ab22db8c69ffad8209f3258c7e22acb04eb668 which fixed my issue

but idk if right now you guys are stabilizing everything for next release :shrug:

Waiting for it, cheers :clinking_glasses: