Loading src/shell.cpp +9 −4 Changes for src/shell.cpp: 9 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -963,6 +963,11 @@ std::vector<std::string> fresh::tokenizeShellArgs(const std::string &segment){ // double-quoted case just above (see its own comment) -- a // bare '$' emitted here would be just as vulnerable to the // later, escape-blind Environment::expand() call over `pending`. // An escaped glob character is quoted: it never takes part in // pathname expansion (make recipes pass `expr 7 \* 65536`, // which globbed to the directory listing). if(segment[i+1]=='*' || segment[i+1]=='?' || segment[i+1]=='[') anyquoted=true; pending+=(segment[i+1]=='$') ? kLiteralDollarMarker : segment[i+1]; i+=2; continue; Loading Loading @@ -3311,7 +3316,7 @@ int fresh::Shell::runSegmentWords(const std::string &input,const std::vector<She words[i-1].text=="||" || words[i-1].text=="|" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="!"); words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="!" || words[i-1].text=="{"); if(stmtStart && (w=="if" || w=="for" || w=="while" || w=="until" || w=="case" || w=="{")) ++d; else if(stmtStart && d>0 && (w=="fi" || w=="done" || w=="esac" || w=="}")) --d; else if(d==0 && w=="|") return runSimple(shellWordsRawText(input,words,from,to)); Loading Loading @@ -3373,7 +3378,7 @@ int fresh::Shell::runSegmentWords(const std::string &input,const std::vector<She words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="!"); words[i-1].text=="else" || words[i-1].text=="!" || words[i-1].text=="{"); if(atStmtStart && words[i].text=="{") ++depth; else if(atStmtStart && words[i].text=="}"){ if(--depth==0){ closeIdx=i; break; } Loading Loading @@ -3526,7 +3531,7 @@ void fresh::Shell::collectFunctionDefinitions(const std::string &input,std::vect words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="!"; words[i-1].text=="else" || words[i-1].text=="!" || words[i-1].text=="{"; if(depth==0 && atStmtStart){ std::string name; Loading Loading @@ -3864,7 +3869,7 @@ int fresh::Shell::parse(const std::string &input,bool applyErrexit){ words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="!"); words[i-1].text=="else" || words[i-1].text=="!" || words[i-1].text=="{"); if(atStmtStart && (w=="if" || w=="for" || w=="while" || w=="until" || w=="case" || w=="{")) ++depth; else if(atStmtStart && depth>0 && (w=="fi" || w=="done" || w=="esac" || w=="}")) Loading Loading
src/shell.cpp +9 −4 Changes for src/shell.cpp: 9 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -963,6 +963,11 @@ std::vector<std::string> fresh::tokenizeShellArgs(const std::string &segment){ // double-quoted case just above (see its own comment) -- a // bare '$' emitted here would be just as vulnerable to the // later, escape-blind Environment::expand() call over `pending`. // An escaped glob character is quoted: it never takes part in // pathname expansion (make recipes pass `expr 7 \* 65536`, // which globbed to the directory listing). if(segment[i+1]=='*' || segment[i+1]=='?' || segment[i+1]=='[') anyquoted=true; pending+=(segment[i+1]=='$') ? kLiteralDollarMarker : segment[i+1]; i+=2; continue; Loading Loading @@ -3311,7 +3316,7 @@ int fresh::Shell::runSegmentWords(const std::string &input,const std::vector<She words[i-1].text=="||" || words[i-1].text=="|" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="!"); words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="!" || words[i-1].text=="{"); if(stmtStart && (w=="if" || w=="for" || w=="while" || w=="until" || w=="case" || w=="{")) ++d; else if(stmtStart && d>0 && (w=="fi" || w=="done" || w=="esac" || w=="}")) --d; else if(d==0 && w=="|") return runSimple(shellWordsRawText(input,words,from,to)); Loading Loading @@ -3373,7 +3378,7 @@ int fresh::Shell::runSegmentWords(const std::string &input,const std::vector<She words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="!"); words[i-1].text=="else" || words[i-1].text=="!" || words[i-1].text=="{"); if(atStmtStart && words[i].text=="{") ++depth; else if(atStmtStart && words[i].text=="}"){ if(--depth==0){ closeIdx=i; break; } Loading Loading @@ -3526,7 +3531,7 @@ void fresh::Shell::collectFunctionDefinitions(const std::string &input,std::vect words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="!"; words[i-1].text=="else" || words[i-1].text=="!" || words[i-1].text=="{"; if(depth==0 && atStmtStart){ std::string name; Loading Loading @@ -3864,7 +3869,7 @@ int fresh::Shell::parse(const std::string &input,bool applyErrexit){ words[i-1].text=="if" || words[i-1].text=="elif" || words[i-1].text=="while" || words[i-1].text=="until" || words[i-1].text=="do" || words[i-1].text=="then" || words[i-1].text=="else" || words[i-1].text=="!"); words[i-1].text=="else" || words[i-1].text=="!" || words[i-1].text=="{"); if(atStmtStart && (w=="if" || w=="for" || w=="while" || w=="until" || w=="case" || w=="{")) ++depth; else if(atStmtStart && depth>0 && (w=="fi" || w=="done" || w=="esac" || w=="}")) Loading