Project

General

Profile

Actions

Bug #2390

closed

getcwd() problem on Cygwin (without Cygwin environment)

Added by Anonymous about 12 years ago. Updated over 7 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

getcwd() function can't get absolute path without cygwin environment (win32 native usage)

C:\Program Files\LightTPD>lighttpd.exe -f conf/lighttpd.conf -m modules -p
config {
    var.PID                        = 40388
    var.CWD                        = "/LightTPD" 
...

This patch solve this problem:

C:\Program Files\LightTPD>lighttpd.exe -f conf/lighttpd.conf -m modules -p
config {
    var.PID                        = 40488
    var.CWD                        = "C:/Program Files/LightTPD" 
...

Files

src-configfile.c.patch (2.47 KB) src-configfile.c.patch Anonymous, 2012-02-13 23:47
Actions #1

Updated by stbuehler almost 12 years ago

  • Target version changed from 1.4.31 to 1.4.x
Actions #2

Updated by gstrauss almost 8 years ago

  • Status changed from New to Need Feedback

I am a bit confused by your use of 'native'. The patch looks like it is for building under __CYGWIN__. Is this for lighttpd compiled under cygwin, but then executed outside of the cygwin environment?

Actions #3

Updated by gstrauss almost 8 years ago

wlmp: the patch provided leaks memory allocated in posixpath.

Also, why bother converting? If a Windows-style path with drive letter is needed, why not use GetCurrentDirectory()? https://msdn.microsoft.com/en-us/library/windows/desktop/aa364934(v=vs.85).aspx

Would you please describe the problem you are seeing? This might be a linking issue rather than a code issue, e.g. possibly needing to link statically with cygwin libraries so that the binary has posix path semantics when the exectuable is run outside the cygwin environment.

I'd like to help you get this fixed in lighttpd, but need some feedback how you're building lighttpd and what behavior you are seeing that needs to be fixed. Thanks.

Actions #4

Updated by gstrauss over 7 years ago

  • Status changed from Need Feedback to Fixed
  • Target version changed from 1.4.x to 1.4.40

I can not reproduce that issue above, and while you have provided a patch, you have not provided a description of the errors encountered, which the patch purportedly fixes.

I have been able to compile and install lighttpd in a cygwin64 environment, and have been able to run the executable from a Windows command prompt (outside the cygwin environment).

After applying https://redmine.lighttpd.net/projects/lighttpd/repository/revisions/8dcbd61a45851f5492425acc1b19e4fd7081424b,
'make check' tests pass, so it appears that your proposed patch is unnecessary. If you have a different usage scenario, please file a new ticket as a Feature request (not a Bug, since lighttpd works under cygwin64) and better describe your usage and errors encountered.

  • debugging: install cygwin-debuginfo package for more useful info from strace
  • running lighttpd.exe from outside the cygwin environment requires PATH be set
    using Windows paths (C:\...) and using semi-colon (';') as path separators,
    since Windows looks in PATH to find cyglightcomp.dll built with lighttpd.
    Note that the cygwin library will rewrite Windows paths in PATH to unix-style
    cygwin paths such as /cygdrive/c/... for the running lighttpd process.
    e.g. lighttpd.bat to run lighttpd built and installed in non-default location:
    # lighttpd.bat
    # - C:\cygwin64 is Cygwin root in this example
    # - custom lighttpd.exe built and installed with
    #   ./configure --prefix=/opt/lighttpd ...
    # - custom lighttpd.conf in /opt/lighttpd/etc/lighttpd.conf
    # - backgrounding works (remove -D below which keeps lighttpd in foreground)
    PATH=C:\cygwin64\opt\lighttpd\bin;C:\cygwin64\usr\local\bin;C:\cygwin64\bin
    C:\cygwin64\opt\lighttpd\sbin\lighttpd.exe -D -f /opt/lighttpd/etc/lighttpd.conf
    
Actions

Also available in: Atom