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

scrot 'test$' creates test$ #270

Open
guijan opened this issue Apr 9, 2023 · 5 comments
Open

scrot 'test$' creates test$ #270

guijan opened this issue Apr 9, 2023 · 5 comments
Labels
docs Documentation related

Comments

@guijan
Copy link
Contributor

guijan commented Apr 9, 2023

Commit 2e33c4c changed scrot's behavior.

In 7ee199c (the preceding commit), scrot 'test$' would create a file named test. 2e33c4c creates a file named test$.

@guijan guijan changed the title scrot 'test$' creates _test$_ scrot 'test$' creates test$ Apr 9, 2023
@guijan
Copy link
Contributor Author

guijan commented Apr 9, 2023

More information because this is a bit cryptic: scrot ignores the $ of invalid special strings in an output filename. However, ever since 2e33c4c, if the $ is the last character in the string, it isn't ignored.

@N-R-K
Copy link
Collaborator

N-R-K commented Apr 9, 2023

That change was intentional. But since it ignores unknown specifier in normal cases (which I didn't consider at the time), I can see how this can be confusing.

We can change it to either go back to previous behavior where $ or \ as last char would be ignored, or we can output unknown specifiers literally (e.g instead of turning $x into x, output $x instead).

The behavior on unknown specifier is undocumented, so we are free to go either ways.

@guijan
Copy link
Contributor Author

guijan commented Apr 9, 2023

I'd like to hard error on unknown specifiers.

@N-R-K
Copy link
Collaborator

N-R-K commented Apr 9, 2023

I'd like to hard error on unknown specifiers.

For specifiers, sure. I don't mind that.

But what about backslashes? The current behavior on backslashes is extremely confusing (and borderline incorrect) to say the least. The manpage states:

       \n   A literal newline (ignored when used in the filename).

It says, \n ignored when used in filenames, but "ignored" here basically means "skipping" it altogether:

[scrot master]~> ./src/scrot 'test\n<-skipped'
[scrot master]~> ls test*
'test<-skipped'

It also just removes any backslashes for no real reason:

[scrot master]~> ./src/scrot 'test\<-removed' 
[scrot master]~> ls test*
'test<-removed'

So if you wanted an actual backslash, you'd need to use \\.

@guijan
Copy link
Contributor Author

guijan commented Apr 9, 2023

I guess ignoring unnecessary escapes would be what the typical software does. We can do that, and maybe print a warning over it. Or hard error too. I don't know.

Edit: you just reminded me of undocumented behavior in scrot, I don't like it, probably should make an issue about that.

@N-R-K N-R-K added the docs Documentation related label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related
Projects
None yet
Development

No branches or pull requests

2 participants