Opened 13 years ago

Closed 12 years ago

#295 closed defect (fixed)

findstr in addPath runs forever on windows7

Reported by: asgerpetersen Owned by: maphew
Priority: major Component: Package
Version: Keywords:
Cc:

Description

findstr in addpath.bat runs forever on my windows7. Please see attached screendumps.

OS: fresh win7 enterprise sp1

OSGeo4W downloaded on june 27th

Attachments (2)

dump_findstr.PNG (34.3 KB ) - added by asgerpetersen 13 years ago.
findstr command line
dump_findstr2.PNG (24.0 KB ) - added by asgerpetersen 13 years ago.
Running forever…

Download all attachments as: .zip

Change History (20)

by asgerpetersen, 13 years ago

Attachment: dump_findstr.PNG added

findstr command line

by asgerpetersen, 13 years ago

Attachment: dump_findstr2.PNG added

Running forever...

comment:1 by asgerpetersen, 13 years ago

Maybe I should add that this defect of course prevents me from using any osgeo4w program without editing addpath.bat.

The issue also occurs when I use the QGIS "stand alone" installer.

The OS is 64 bit by the way.

comment:2 by maphew, 13 years ago

Thanks for the error report. I haven't reproduced the problem here and need some more information to help troubleshoot: what are the steps leading up to findstr running forever? Does this happen when merely starting the Osgeo4W shell? What about when running programs from within the shell? (as opposed to Start Menu or desktop shortcuts.)

What edit do you make to addpath.bat to bypass the freezing?

...here's a thought: does findstr work at all? Try something like this from a non-osgeo4w command shell (Start > Run > cmd [enter]): findstr /s "findstr" c:\osgeo4w\*.bat*

The results should resemble (b:\o4w is my %osgeo4w_root%):

B:\o4w>findstr /s "findstr" b:\o4w\*.bat*
b:\o4w\bin\addpath.bat:echo("!new!"|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\/]" ^
b:\o4w\bin\addpath.bat:    echo(%%B|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\/]" ^
b:\o4w\bin\inpath.bat:echo("!new!"|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\/]" ^
b:\o4w\bin\inpath.bat:    echo(%%B|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\/]" ^

As as I know the Qgis stand alone install doesn't use addpath.bat. Since you've attempted both maybe the O4W and the stand alone are walking over each other in some way.(?)

comment:3 by jef, 13 years ago

What's the initial setting of PATH? I think PATH can get corrupted if it exceeds a certain - yet unknown - length (_MAX_PATH is only 260). Could you try with a short PATH (eg. running osgeo4w-setup from a cmd with PATH %WINDIR%\system32;%WINDIR%;%WINDIR%\system32\wbem).

comment:4 by jef, 13 years ago

please try the new version of the installer.

in reply to:  4 ; comment:5 by asgerpetersen, 13 years ago

Replying to jef:

please try the new version of the installer.

Hi jef,

Thanks for taking this up. Just to make sure: Is it enough to download and run the installer (from http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe) the same way as before or do I have to remove the old installation in some way?

comment:6 by asgerpetersen, 13 years ago

I tried running the newly downloaded installer on top of the old install. Now I get a crash in findstr (Windows reports "Find String (QGREP) Utility has stopped working") during the install phase.

I will proceed with checking my findstr and path as you suggested earlier.

in reply to:  2 comment:7 by asgerpetersen, 13 years ago

Replying to maphew:

what are the steps leading up to findstr running forever?

It ran forever whenever I tried to start a osgeo4w program from start menu or shortcut.

Does this happen when merely starting the Osgeo4W shell?

Yes.

What about when running programs from within the shell? (as opposed to Start Menu or desktop shortcuts.)

I cannot try that because the shell wont start.

What edit do you make to addpath.bat to bypass the freezing?

Nothing fancy. Just dont use findtr and risc duplicate path entries.

...here's a thought: does findstr work at all? Try something like this from a non-osgeo4w command shell (Start > Run > cmd [enter]): findstr /s "findstr" c:\osgeo4w\*.bat*

My findstr seems to work ok with the simple test case:

C:\Users\asi>findstr /s "findstr" c:\osgeo4w\*.bat*
c:\osgeo4w\bin\addpath.bat:echo("!new!"|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\
\/]" ^
c:\osgeo4w\bin\addpath.bat:    echo(%%B|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\
\/]" ^
c:\osgeo4w\bin\inpath.bat:echo("!new!"|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\
/]" ^
c:\osgeo4w\bin\inpath.bat:    echo(%%B|findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\
/]" ^

As as I know the Qgis stand alone install doesn't use addpath.bat.

The QGIS standalone installer installs a desktop shortcut which makes the following chain of calls:

"C:\Program Files (x86)\Quantum GIS Lisboa\bin\nircmd.exe" exec hide "C:\Program Files (x86)\Quantum GIS Lisboa\bin\qgis.bat"

which sets OSGEO4W_ROOT=C:\PROGRA~2\QUANTU~1 and calls "%OSGEO4W_ROOT%"\bin\o4w_env.bat

o4w_env runs the bat-files in the etc\ini folder and the etc\ini\python.bat file calls addpath.bat

comment:8 by asgerpetersen, 13 years ago

Maybe this is useful: I am able to reproduce on a non-osgeo4w command shell by executing

C:\Users\asi>findstr /i /r /c:"^\"[a-zA-Z]:[
/][
/]"

This call takes forever and ends with findstr crashing

in reply to:  5 ; comment:9 by jef, 13 years ago

Replying to asgerpetersen:

Replying to jef:

please try the new version of the installer.

Thanks for taking this up. Just to make sure: Is it enough to download and run the installer (from http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe) the same way as before or do I have to remove the old installation in some way?

Well, it might have helped if the problem was caused by a (overly long) corrupted path. It might still be caused by some unexpected (danish?) characters in @PATH@.

in reply to:  9 comment:10 by asgerpetersen, 13 years ago

Replying to jef:

Well, it might have helped if the problem was caused by a (overly long) corrupted path. It might still be caused by some unexpected (danish?) characters in @PATH@.

Here is my path:

C:\Users\asi>set path
Path=C:\spatialsuite\app\perl\site\bin;C:\spatialsuite\app\perl\bin;C:\app\Oracl
e\Ora11g_32Home\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\W
indows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSyste
m\;C:\Program Files\ActivIdentity\ActivClient\;C:\Program Files (x86)\ActivIdent
ity\ActivClient\;C:\Program Files (x86)\Hewlett-Packard\IAM\bin;C:\App\Script\;C
:\App\Bin\;C:\App\SysInternals\;C:\Program Files\Java\jdk1.6.0_31\bin

I guess the difference is with findstr.

It behaves differently on my XP and on my Win7 machines. This command

findstr /i /r /c:^"^^\"[a-zA-Z]:[\\/][^\\/]"

crashes findstr on Win7 but it doesnt on XP

comment:11 by maphew, 13 years ago

Following up on mailing list (same subject line), as this is getting a bit long for a ticket. We'll summarise the results here afterwards.

comment:13 by jef, 12 years ago

Remind me please, why we need addpath. A duplicated entry in PATH isn't harmful. BTW might it be useful to start with a clean path in OSGeo4W (ie. %WINDIR%;%WINDIR%\system32) instead of appending to the systems path?

comment:14 by maphew, 12 years ago

Jef, I don't know that it's _needed_ exactly. I added it because a) it's just cleaner not to have duplicates, and b) there is a maximum PATH length*, though I've not personally run into it in a very very long time.

I've forgotten the details, but I think my initial impetus for looking for and finding addpath.bat was running into .bat files in ./etc/ini/ from different packages adding the same PATH entries.

That said, if it's causing problems we can drop it. It accomplishes what I'm after but I'm not entirely comfortable with it (there's too much going on inside addpath.bat file that I don't understand). In this ticket though the problem is not addpath but findstr (or something findstr depends on).

--- As for starting with a minimal path instead of appending to the system default, I personally have a number of non-Windows and non-Osgeo4W utils that I use frequently. So using sys-default + osgeo4w is easier, for me. I imagine there might be others in the same camp. I'm flexible though and am happy to add the desired environment after the fact if need be (all it takes is dropping a new .bat file in ./etc/ini).

comment:15 by asgerpetersen, 12 years ago

We now have 50+ win7 machines where we cannot use osgeo4w and qgis without hacking it because of this issue. So I vote for removing addpath for now :-)

comment:16 by maphew, 12 years ago

ok, I'm convinced we should remove addpath. I don't know when I'll get to it, still catching up on the vacation backlog, so feel free to jump in. :)

comment:17 by maphew, 12 years ago

Owner: changed from osgeo4w-dev@… to maphew
Status: newassigned

c.f. http://lists.osgeo.org/pipermail/osgeo4w-dev/2012-December/001969.html, remember to insert o4w to beginning of PATH

comment:18 by maphew, 12 years ago

Resolution: fixed
Status: assignedclosed

closed with shell v1.0.0-13.

My laptop ran out of battery life before I finished testing the first archive I uploaded, and there was a mistake inserting Osgeo4w\bin into PATH. While I was offline the test package was promoted to production. Consequently for up to half a day people may have been installing the broken ...0-12.

The fix is to just edit Osgeo4w.bat and change PATH=%OSGEO4W_ROOT%;%PATH% to PATH=%OSGEO4W_ROOT%\bin;%PATH%.

Note: See TracTickets for help on using tickets.