cdown / clipmenu

Clipboard management using dmenu
MIT License
1.14k stars 91 forks source link

Error on clipdel with special characters #114

Closed ghost closed 4 years ago

ghost commented 5 years ago

I called clipdel -d 'e.g.passX\(sghs' for try to delete a password with special characters (generated with pass) I get the next error:

sed: -e expression #1, char 36: Unmatched ) or \)
sed: -e expression #1, char 36: Unmatched ) or \)
sed: -e expression #1, char 36: Unmatched ) or \)

I tried to escape the password but it not worked

    value=
    clipdel -d $(printf '%q' "$(xsel -b)")
cdown commented 4 years ago

Yeah, this is a bug due to the fact we use sed without special escaping of the inputs. I'll look at fixing it for the next release.

cdown commented 4 years ago

Oh wait, it's not a bug. By contract -d takes a BRE regex :-)

Try not escaping (.

ghost commented 4 years ago

@cdown 'e.g.passX\(sghs' is password without escaping, so I think one option is be able to call without -d or with another option to delete a literal string without regex

cdown commented 4 years ago

There's no need to escape anything. ( in BRE means (.

ghost commented 4 years ago

@cdown \ and ( are part of the password

current data in the clipboard screenshot-2020-03-25_16-32-04

when I try to delete one entry with random characters like a password screenshot-2020-03-25_16-28-41

cdown commented 4 years ago

Ok, so you need to escape it then to make it a valid BRE. It should be \\(.

It's possible to add a non-regex mode, but I don't really use clipdel, so it would be a community addition.

cdown commented 4 years ago

Closing for now without prejudice, since I think that we came to an agreement that it's intended behaviour. However, I agree with you that a "literal" mode that doesn't take a regex would also be a nice addition. :-)