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

Zero-byte files left behind when trying to flac.exe out of subset #617

Open
H2Swine opened this issue Jun 1, 2023 · 4 comments
Open

Zero-byte files left behind when trying to flac.exe out of subset #617

H2Swine opened this issue Jun 1, 2023 · 4 comments

Comments

@H2Swine
Copy link

H2Swine commented Jun 1, 2023

1.4.2 for Windows, the file is CDDA so that -b8192 is out of subset.

Scenario 1:
flac -fb8192 file.flac
Result: Leaves zero-byte .tmp,fl-ac+en'c . At least it tells me what file I failed at.

Scenario 2:
flac -t file.flac
flac -fb8192 file.wav
Result: Overwrites file.flac with a zero-byte file.

Expected: at least in the last scenario, it should throw error and do nothing at all?

@ktmf01
Copy link
Collaborator

ktmf01 commented Jun 1, 2023

At least part of this is fixed in #506

Could you check with a recent binary from https://hydrogenaud.io/index.php/topic,123176.msg1027870.html#msg1027870

@H2Swine
Copy link
Author

H2Swine commented Jun 1, 2023

That one leaves no trace.
Although I am not sure if it is wanted behaviour ... ? Maybe it is in line with what flac -f file.wav does otherwise, which is (I think?) delete file.flac first and then do whatever comes out of it. Most likely a user who gives flac -f file.wav wants file.flac overwritten with a valid lossless file or not overwritten at all, but that isn't the behaviour in other situations either?

@ktmf01
Copy link
Collaborator

ktmf01 commented Jun 2, 2023

I'm unsure whether fixing this would be an improvement.

As far as I know, currently, using -f always results in the deletion of any file that has the name of the intended output file. I could take a look at the code whether it is possible to delay the removal of that file until as late as possible. That would 'solve' a few cases like this, but then behaviour isn't as consistent anymore: it is no longer clear when the file will be removed and when it will not be. An error during initialization might be 'caught', but an error during encoding itself will not be. For a user, it is no longer clear what to expect.

Furthermore, in the specific case you mention, it is reasonable to assume the user will try again, overwriting the file anyway.

@H2Swine
Copy link
Author

H2Swine commented Jun 2, 2023

I'm also not sure, so maybe this issue can be closed as completed.

But - luckily! - the following isn't correct:

As far as I know, currently, using -f always results in the deletion of any file that has the name of the intended output file.

Not always. Not upon recompression - then source isn't deleted until target is done. (And please keep it that way.)

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

No branches or pull requests

2 participants