[Bug 27741] Imbricated for loops parameters not expanded correctly

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Nov 4 18:23:31 CST 2012


http://bugs.winehq.org/show_bug.cgi?id=27741

Jason Edmeades <us at edmeades.me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |us at edmeades.me.uk

--- Comment #5 from Jason Edmeades <us at edmeades.me.uk> 2012-11-04 18:23:31 CST ---
99% of this will be fixed when I get my fix for 21047 in (all todos were I
think)

The problem is I have one case I cannot see how to resolve at present, and its
an extreme corner case which I think is best left waiting for a real life
usecase (other than a todo in tests) is
for %a in....
   for %a in ....
When reading the 2nd line, wine finds the %a and helpfully expands it, meaning
the for loop logic doesnt find a variable anymore. No idea how windows does
this, other than not expanding anything after a 'for'...

It does expand the rest on the line, e.g. the %%a in the brackets is correctly
expanded:
for %%a in ("foobar") do (
  echo %%a
  for %%a in (%%a) do (
    echo %%a
  )
)

Something like the following (yes, I am warped at times) doesnt work in
windows:
for /f "delims=:" %%a in ("in (jason) do echo %%b") do (
echo %%a
for %%b %%a
)

So I think windows see's a line starting with for, and does special processing
/ no expanding until it gets beyond the first '('. More testing/experimenting,
but wanted to document findings so far.

I have very strong suspicions that for (at least, possibly 'if' too) has
special, individual parsing which might explain why this happens - for example
you cannot 'call' a for loop, and whilst the following works for echo, it
doesnt work for a 'for' loop... "for %a in (echo.hello) do %a"

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list