You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
set_key does not handle single quote ' inside value properly #543
Grouping the shell-quoting work here so it's easy to track:
#670 makes the export=True path shell-safe - for a value like this it writes export VAR="I'm a bug :(", which both source and dotenv read back correctly. So the export case is covered there.
The exact repro in this issue is the default (non-export) path though, and that's still open: set_key(".env", "VAR", "I'm a bug :(") writes VAR='I\'m a bug :(', which dotenv parses back fine but bash can't source (a \' inside single quotes isn't valid in bash). Worth deciding separately whether non-export output should be POSIX-sourceable at all, since that's a slightly different contract from "dotenv can round-trip it".
Related: #544 is the parser side of the same theme (reading a hand-written 'I'\''m' bash-concat value), and #670 doesn't touch the parser, so that one stands on its own too.
Activity
theskumar commentedon Aug 16, 2026
Grouping the shell-quoting work here so it's easy to track:
#670 makes the
export=Truepath shell-safe - for a value like this it writesexport VAR="I'm a bug :(", which bothsourceand dotenv read back correctly. So the export case is covered there.The exact repro in this issue is the default (non-export) path though, and that's still open:
set_key(".env", "VAR", "I'm a bug :(")writesVAR='I\'m a bug :(', which dotenv parses back fine but bash can'tsource(a\'inside single quotes isn't valid in bash). Worth deciding separately whether non-export output should be POSIX-sourceable at all, since that's a slightly different contract from "dotenv can round-trip it".Related: #544 is the parser side of the same theme (reading a hand-written
'I'\''m'bash-concat value), and #670 doesn't touch the parser, so that one stands on its own too.