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

Trailing newline is added during encryption/decryption #272

Open
danielparks opened this issue Dec 7, 2018 · 4 comments
Open

Trailing newline is added during encryption/decryption #272

danielparks opened this issue Dec 7, 2018 · 4 comments

Comments

@danielparks
Copy link

Hiera eyaml 2.1.0 ensures there is a trailing newline when run from the command line.

❯ echo -n nonl >no_newline
❯ od -c no_newline
0000000    n   o   n   l
0000004
❯ eyaml encrypt -f no_newline -o string | tr -d '\n' | eyaml decrypt --stdin | od -c 
0000000    n   o   n   l  \n                                            
0000005
❯ echo yesnl >yes_newline 
❯ od -c yes_newline 
0000000    y   e   s   n   l  \n                                        
0000006
❯ eyaml encrypt -f yes_newline -o string | tr -d '\n' | eyaml decrypt --stdin | od -c
0000000    y   e   s   n   l  \n                                        
0000006

This is inconsistent. It should either add the newline (nonl\n and yesnl\n\n) or not add the newline (nonl and yesnl\n).

Originally #264, though I got the title backward that time. Thanks to @bifek for finding a good test case.

@bifek
Copy link

bifek commented Dec 7, 2018

encryption is fine. even decryption itself is fine, it's only in emitting the output that it unnecessary adds newline. see #270

@danielparks
Copy link
Author

A simpler example:

❯ eyaml encrypt -s nonl -o string | tr -d '\n' | eyaml decrypt --stdin | od -c
0000000    n   o   n   l  \n                                            
0000005

@TwizzyDizzy
Copy link

TwizzyDizzy commented Feb 17, 2021

Hi folks,

I'd like to add that this issue seems to only manifest in eyaml output mode string. If I use the block output (and the according syntax in hiera itself) the output is what you would expect.

Might help to narrow down the issue.

EDIT: well this somehow is obvious from the examples above because -o string is used, but I thought I'd spell it out.

Cheers
Thomas

@bifek
Copy link

bifek commented Feb 18, 2021

in my testing this is the same

% { echo '>'; echo -n nonl | eyaml encrypt --stdin -o block; } | eyaml decrypt --stdin | od -c
0000000   n   o   n   l  \n

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

No branches or pull requests

3 participants