From: Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de>
To: ntg-context@ntg.nl
Subject: quoted environment arguments
Date: Mon, 18 Oct 2010 15:48:47 +0200 [thread overview]
Message-ID: <20101018134847.GA8173@orcus> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 1626 bytes --]
Hi,
there’s a behaviour concerning how context handles forced quotes
in command line arguments that I do not understand.
··· <example> ···················································
for i=-1,#environment.rawarguments do
print(i, environment.rawarguments[i], environment.originalarguments[i])
end
·· </example> ···················································
Now run this as ‘test.lua’ with mtxrun:
# mtxrun --script test.lua \"simple\" \"more complex\"
Here I get the following output:
··· <result> ····················································
-1 texlua texlua
0 /home/kokytos/context/tex/texmf-linux/bin/mtxrun /home/kokytos/context/tex/texmf-linux/bin/mtxrun
1 --script --script
2 test.lua test.lua
3 "simple" simple"
4 "more more complex
5 complex" nil
·· </result> ····················································
Number 3 indicates that a quoted argument is fully unquoted iff
it gets parsed into multiple arguments. It also leads to
‘Unbalanced quotes in argument ./simple"’ when used with the main
‘context’ script. It would make sense if you expect only args
containing spaces to be explicitly quoted, though.
I would propose a patch like the one I attached but I’m having
difficulties testing locally modified copies of the core Lua
files, so it remains untested.
Philipp
[-- Attachment #1.1.2: luat-env.patch --]
[-- Type: text/plain, Size: 681 bytes --]
--- /home/kokytos/base/luat-env.lua 2010-10-18 15:23:24.053334794 +0200
+++ luat-env.lua 2010-10-18 15:27:47.320001408 +0200
@@ -183,10 +183,12 @@
for index=1,#arg do
local argument = arg[index]
if find(argument,"^\"") then
- newarg[#newarg+1] = gsub(argument,"^\"","")
if not find(argument,"\"$") then
instring = true
+ else
+ argument = argument:gsub("\"$", "")
end
+ newarg[#newarg+1] = gsub(argument,"^\"","")
elseif find(argument,"\"$") then
newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","")
instring = false
[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 486 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
reply other threads:[~2010-10-18 13:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101018134847.GA8173@orcus \
--to=pgesang@ix.urz.uni-heidelberg.de \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).