beetbox / beetbox/beets

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

Open
#5,484 1 comment 0 reactions 0 assignees View on GitHub
convert
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### 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:

```python
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:

```bash
...
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:

```bash
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:
```bash
cp --reflink=auto /tmp/tmpofeiyiwv.opus /home/matiii/Music/beets/Taco\ Hemingway/1‐800‐OŚWIECENIE/bez.opus
matiii@matiii $ # works well!
```

### Setup

* OS: Arch Linux x86_64 - 6.11.3-arch1-1
* Python version: 3.12.7
* beets version: ~~1.6.1~~ 2.0.0 apparently
* Turning off plugins made problem go away (yes/no): ummm... technically yeah xD

My configuration (output of `beet config`) is:

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

...

convert:
auto: yes
max_bitrate: 96
format: opus
```

Contributor guide

Open the contributing guide

Research direction

Start with the convert plugin's interaction with import reflink handling and reproduce the reported configuration on separate /tmp and destination filesystems. Compare the failing reflink path with the successful `cp --reflink=auto` behavior; done means conversion completes without a reflink error when the filesystems differ.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.