This query relates to Bug #66985. Firstly, is it true varexpand() is an attempt
to reinvent shell expansion?
Now, if I have an string such as:
'"asdf" "asdf" "asdf"'
Then varexpand('"asdf" "asdf" "asdf"') results in
'asdf asdf asdf'
Which is broken because the expected result is
'"asdf" "asdf" "asdf"'
Now a work around is to use some quoting:
>>> varexpand('\\"asdf\\" \\"asdf\\" \\"asdf\\"')
'"asdf" "asdf" "asdf"'
This yields the right result, but if I try to use this work around in an
/etc/env.d/ file (as in the bug mentioned above),
--- !empty dir /usr/bin
--- !empty dir /usr
--- !empty dir /etc
>>> original instance of package unmerged safely.
!!! Invalid token (not "=") \\".\\"
Traceback (most recent call last):
File "/usr/bin/emerge", line 3045, in ?
mydepgraph.merge(mydepgraph.altlist())
File "/usr/bin/emerge", line 1838, in merge
retval=portage.doebuild(y,"merge",myroot,self.pkgsettings,edebug)
File "/usr/lib/portage/pym/portage.py", line 2652, in doebuild
return
merge(mysettings["CATEGORY"],mysettings["PF"],mysettings["D"],mysettings["BUILDDIR"]+"/build-info",myroot,mysettings,myebuild=mysettings["EBUILD"])
File "/usr/lib/portage/pym/portage.py", line 2785, in merge
return mylink.merge(pkgloc,infloc,myroot,myebuild)
File "/usr/lib/portage/pym/portage.py", line 6769, in merge
return self.treewalk(mergeroot,myroot,inforoot,myebuild,cleanup=cleanup)
File "/usr/lib/portage/pym/portage.py", line 6483, in treewalk
env_update(makelinks=(not downgrade))
File "/usr/lib/portage/pym/portage.py", line 490, in env_update
myconfig=getconfig(root+"etc/env.d/"+x)
File "/usr/lib/portage/pym/portage_util.py", line 273, in getconfig
raise e.__class__, str(e)+" in "+mycfg
Exception: ParseError: Invalid token (not '='): /etc/env.d/50scsh: line 2 in
/etc/env.d/50scsh
The contents of the /etc/env.d/50scsh file were:
SCSH_LIB_DIRS=\\"/usr/lib/scsh/modules/0.6\\" \\"/usr/lib/scsh\\" \\".\\"
So varexpand() and its use from env_update() seem to be flawed. How can I work
around this problem?
Best regards,
--
Matthew Kennedy
--
[email protected] mailing list