Opened 18 years ago

Closed 18 years ago

Last modified 15 years ago

#2344 closed defect (fixed)

Wrong path_prefix handling in cygwin builds

Reported by: forenr@… Owned by: lasgouttes
Priority: high Milestone: 1.4.4
Component: general Version: 1.4.0cvs
Severity: normal Keywords: patch
Cc:

Description

When LyX is built using cygwin tools in Windows, a new check button labeled
"Use Cygwin-style paths" is available in Tools->Preferences->Outputs->Paths.

When this button is checked, filling in "PATH prefix" in Tools->Preferences
results in LyX completely loosing track of any path and it is unable to find
any program. This is due to the following reason.

The default path separator in cygwin is ':' and thus "PATH prefix" has to be
entered in posix (cygwin) format. However, when the "Use Cygwin-style paths"
button is checked, every PATH component gets translated in mixed form (sic!),
i.e., in a pseudo Windows form with backslashes replaced by forward slashes.

So, when the path_prefix is prepended to the system PATH this results in a
malformed PATH list and the PATH gets nuked.

For example, filling in "PATH prefix" as follows:

/usr/local/bin:/usr/bin

results in LyX trying to set the following PATH

C:/cygwin/usr/local/bin:C:/cygwin/usr/bin:<system PATH here>

where <system PATH here> is replaced by the value of the PATH variable.
This is clearly an invalid posix PATH list as that would mean that the
following dirs should be in the PATH:

C
/cygwin/usr/local/bin
C
/cygwin/usr/bin
...

and none of them exist. As a result, the PATH is now nuked.

Attachments (1)

2344-fix.txt (358 bytes ) - added by forenr@… 18 years ago.
fix

Download all attachments as: .zip

Change History (11)

by forenr@…, 18 years ago

Attachment: 2344-fix.txt added

fix

comment:1 by lasgouttes, 18 years ago

What is the status of this now?

comment:2 by forenr@…, 18 years ago

I am working on fixing all the cygwin related path problems.

I have reorganized things in this way:
1) The kind of path style to be written into .tex files is only decided by

the configure script which checks what the correct style is (miktex vs
cygwin tetex).

2) I am maintaining the "Use Cygwin-style paths" checkbox, but now it is

unrelated to the cygwin_path_fix_ switch. When unchecked, all paths written
to .lyx files, returned by the dialogs, and shown in preferences are in
win-style, including the PATH prefix. In this way, the .lyx files written
by the cygwin version can also be read by the native LyX version (when they
contain absolute paths) and the program has a quite windowish flavor.

I have an almost finished patch and it is working with all my tests. The only
problem that I am facing is that when "Use Cygwin-style paths" is unchecked,
the entries in "File->Open recent" are blank. I think this will be easy to fix.

Anyway, the patch in attachment 1000 is still needed (it is slightly different
in my current overall patch) and I cannot avoid the #ifdef.

My plan was to post the overall patch to the devel list once I solved the
last nuisance above. I hope to have it fixed by tonight.

comment:3 by lasgouttes, 18 years ago

Enrico, what is the status now?

comment:4 by forenr@…, 18 years ago

The bug is fixed.

This is currently done by #ifdef'd code. IMO, a more elegant solution avoiding
#ifdef's could be replacing the call to ::setenv() in src/support/environment.C
(there is a single call there) by a call to lyx::support::os::setenv(), to be
located in src/support/os_xxx.C.

I can put together a patch if I have green light.

comment:5 by jug, 18 years ago

Severity: majorenhancement

comment:6 by jug, 18 years ago

Resolution: fixed
Status: newclosed

Yes.

comment:7 by Uwe Stöhr, 18 years ago

Keywords: patch added
Milestone: 1.4.4
Resolution: fixed
Severity: enhancementnormal
Status: closednew

Please leave this open until it is fixed in trunk _and_ 1.4 branch!

comment:8 by forenr@…, 18 years ago

Uwe, it is indeed fixed both in trunk and 1.4.

comment:9 by Uwe Stöhr, 18 years ago

Resolution: fixed
Status: newclosed

it is indeed fixed both in trunk and 1.4.

OK, I missed it then in TRAC.

comment:10 by lasgouttes, 15 years ago

Component: supportgeneral
Note: See TracTickets for help on using tickets.