Skip to content
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

Metaflac: Filename symlinks are overwritten if --import-picture-from is used #673

Closed
lazypingu opened this issue Mar 2, 2024 · 3 comments · Fixed by #740
Closed

Metaflac: Filename symlinks are overwritten if --import-picture-from is used #673

lazypingu opened this issue Mar 2, 2024 · 3 comments · Fixed by #740

Comments

@lazypingu
Copy link

lazypingu commented Mar 2, 2024

I faced an issue with metaflac and symlinks.
Metaflac seems to override the symlink to a filename instead of modifing the file behind the link, when using the option --import-picture-from=picture.

Other options like --set-tag or --import-cuesheet-from seems to work as expected and the link is still valid afterwards.

Version:
metaflac 1.4.3
metaflac git-66152791 20240301

What would I expect:
Metaflac modifies the file behind the symlink instead of the link itself when using --import-picture-from.

How to reproduce:

  • create flac file test.flac and picture file cover
  • create symlink to flac file: ln -s test.flac testlink
  • try to add picture with: metaflac --import-picture-from=cover testlink
  • check link afterwards (link was replaced with the flac file in my case)

I also tested different shells (bash, ksh, dash), which seems to have the same result.

Not sure if this is an issue on metaflac itself. Might be also a rare case.

@ktmf01
Copy link
Collaborator

ktmf01 commented Mar 3, 2024

FLAC metadata is at the start of the file. When metadata is added and padding is available for use, the metadata is rewritten in place. When not enough padding is available, the file is rewritten completely as a temporary file, then the old file is deleted and the temporary file renamed.

Of course, this doesn't work with symlinks. I am not sure yet whether there is a way to fix this.

@lazypingu
Copy link
Author

lazypingu commented Mar 4, 2024

Thanks for the explanation! Since this use case might be rare anyways, it could also be fine to just recommend to avoid using symlinks with flac/metaflac in general, if this is not easily changeable.

@lazypingu
Copy link
Author

I've removed

Also no issues with flac --picture.

from my initial description, since flac seems to create a new file .flac instead of updating the file behind the link.
So I assue this is a similar behavior as with metaflac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants