public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* CYGWIN app crashes ungracefully when run from the root of a drive
@ 2012-06-11 15:40 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
  2012-06-18 20:22 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Lavrentiev, Anton (NIH/NLM/NCBI) [C] @ 2012-06-11 15:40 UTC (permalink / raw)
  To: cygwin

Hi,

Maybe it has been covered somewhere -- I could not find the answer, so please
excuse the repetition.  I observe that if I build an app (consider the simplest
"Hello world" program below as an example), and store the executable at a standalone
location (not CYGWIN tree), yet supplemented it with a cygwin1.dll, it can then successfully
run when started in the Windows shell (CMD.EXE) from a subdirectory, but fails ungracefully
if run from the root of a drive (e.g. when stored onto a USB stick that has the "flat"
file structure, w/o subdirectories).

Can anything be done about it?  (Like allowing the app to run, or issuing an error
saying "move me to a subdirectory" -- if there are principal problems of not being able
to launch from the root directory.  The same "friendlier" manner than Windows warns
that it cannot run "a.exe" because "cygwin1.dll" is missing -- like in the case when
the DLL was not copied to the "subdir" along with the executable.)

Thanks!

#include <stdio.h>

int main(void)
{
  printf("Hello world!\n");
  return 0;
}

F:\subdir>a.exe
Hello world!

F:\subdir>cd ..

F:\>a.exe
      0 [main] a 2832 F:\a.exe: *** fatal error - add_item ("\??", "/", ...) failed, errno 22
Stack trace:
Frame     Function  Args
002868A8  6102F50B  (002868A8, 00000000, 00000000, 00000000)
00286B98  6102F50B  (6119DDA0, 00008000, 00000000, 6119FC4F)
00287BC8  6100612C  (611DD560, 00287BF4, 00000000, 60FE000C)
00287BE8  61006168  (611DD560, 00289C10, 00000016, 0003000A)
0028AC28  61091474  (60FE000C, 6122EC60, 0028ACF8, 610831B0)
0028ACF8  610D32EF  (00000000, 0028CD78, 61006720, 00000000)
End of stack trace

F:\>

Anton Lavrentiev
Contractor NIH/NLM/NCBI


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: CYGWIN app crashes ungracefully when run from the root of a drive
  2012-06-11 15:40 CYGWIN app crashes ungracefully when run from the root of a drive Lavrentiev, Anton (NIH/NLM/NCBI) [C]
@ 2012-06-18 20:22 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2012-06-18 20:22 UTC (permalink / raw)
  To: cygwin

On Jun 11 11:39, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> Hi,
> 
> Maybe it has been covered somewhere -- I could not find the answer, so please
> excuse the repetition.  I observe that if I build an app (consider the simplest
> "Hello world" program below as an example), and store the executable at a standalone
> location (not CYGWIN tree), yet supplemented it with a cygwin1.dll, it can then successfully
> run when started in the Windows shell (CMD.EXE) from a subdirectory, but fails ungracefully
> if run from the root of a drive (e.g. when stored onto a USB stick that has the "flat"
> file structure, w/o subdirectories).
> 
> Can anything be done about it?  (Like allowing the app to run, or issuing an error

I just applied a patch which allows to run Cygwin applications, even if
the Cygwin DLL is installed into the root directory of a drive or
network path.

Note that certain paths still have to match the expectations.  For
instance, if D: is the root dir, the fstab, passwd and group files are
still searched in /etc, which is D:\etc.
Also the /usr/bin and /usr/lib default mount points will invariably
point to D:\bin and D:\lib, unless there's a /etc/fstab file which
changes them per the user's guide.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-18 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-11 15:40 CYGWIN app crashes ungracefully when run from the root of a drive Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2012-06-18 20:22 ` Corinna Vinschen

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 read-only IMAP folder(s) and NNTP newsgroup(s).