Fix reading environment variables with newline
ClosedPublic

Authored by fvogt on Oct 18 2019, 7:37 AM.

Details

Summary

Use '\0' as separator as '\n' is likely to appear in values.

BUG: 413130

Test Plan

/etc/profile.d/mc.sh exported an mc() function,
which resulted in "syntax error: unexpected end of file" in the Plasma session.
Now the mc function is correctly set in the environment.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
fvogt created this revision.Oct 18 2019, 7:37 AM
Restricted Application added a project: Plasma. · View Herald TranscriptOct 18 2019, 7:37 AM
fvogt requested review of this revision.Oct 18 2019, 7:37 AM
fvogt updated this revision to Diff 68217.Oct 18 2019, 7:38 AM

arc is a PoS

fvogt added a comment.Oct 18 2019, 7:42 AM

Note, the "-0" option is only available in GNU env, not in BSD /env... I can't think of a better way to fix this though other than implementing env ourselves in native code.

davidedmundson accepted this revision.Oct 18 2019, 9:36 AM
davidedmundson added a subscriber: davidedmundson.

Thanks for the swift action

This revision is now accepted and ready to land.Oct 18 2019, 9:36 AM
This revision now requires review to proceed.Oct 18 2019, 9:40 AM
apol accepted this revision.Oct 18 2019, 11:38 AM
adridg accepted this revision.Oct 18 2019, 12:24 PM

Looked for -0 alternatives, couldn't find any. Dave tells me there's sufficient fallbacks, and otherwise we'll just patch it out in packaging.

This revision is now accepted and ready to land.Oct 18 2019, 12:24 PM
This revision was automatically updated to reflect the committed changes.