aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-11-12 12:45:48 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-11-12 12:45:48 +0100
commit8d2eb1ff56ad17fe20e7f42a2e4b9b790640e806 (patch)
tree46222ac2a9d79af2b3b08021567f6264a91b2727 /src/nix
parent2c1e05ae9389742dac637a6f051f718397eff2db (diff)
nix dev-shell: Improve bash output parsing
Fixes handling of '=' in unquoted strings and escaped characters in $'...' strings.
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/shell.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/shell.cc b/src/nix/shell.cc
index 50d0f9c88..6fa471dfc 100644
--- a/src/nix/shell.cc
+++ b/src/nix/shell.cc
@@ -29,6 +29,8 @@ BuildEnvironment readEnvironment(const Path & path)
std::set<std::string> exported;
+ debug("reading environment file '%s'", path);
+
auto file = readFile(path);
auto pos = file.cbegin();
@@ -41,10 +43,10 @@ BuildEnvironment readEnvironment(const Path & path)
R"re((?:="((?:[^"\\]|\\.)*)")?\n)re");
static std::string simpleStringRegex =
- R"re((?:[a-zA-Z0-9_/:\.\-1\+]*))re";
+ R"re((?:[a-zA-Z0-9_/:\.\-\+=]*))re";
static std::string quotedStringRegex =
- R"re((?:\$?'[^']*'))re";
+ R"re((?:\$?'(?:[^'\\]|\\[abeEfnrtv\\'"?])*'))re";
static std::string arrayRegex =
R"re((?:\(( *\[[^\]]+\]="(?:[^"\\]|\\.)*")*\)))re";