Mail Archives: cygwin/2009/09/24/05:41:50
John Emmas schrieb:
> ----- Original Message -----
> From: "John Emmas"
>>
>> I might just try experimenting with a very simple program and see if I
>> still get the error
>>
> I partially tracked down the problem, although I don't quite know how to
> solve it. If I write this simple console app:-
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main ()
> {
> printf ( getenv ("PATH") );
> return 0;
> }
Gee, that is INSECURE. Insert some % in PATH for major fun including crashes
(anyone mistyping CMD.COM like variable expansions for instance, for instance
%USERPROFILE%)
For the records, the right way to do it is either:
puts(getenv("PATH"));
or
printf("%s\n", getenv("PATH"));
I've seen commercial Windows Explorer extensions (SECURITY software incidentally
that shipped with my laptop) kill my Explorer from such beginner's mistakes, and
it's a pity such bogus code is in publicly visible archives and needs to be
corrected through messages like mine.
> it outputs the correct path. However, if I create a GUI app and launch it
> under 'X', the path seems to change and includes lots of duplicated folders.
Probably one of the start scripts adds lots of entries, and X...
> I figured out that startxwin.bat is adding a few duplicated entries to my
> path but that doesn't explain why there are so many duplications and I don't
> know where the others might be coming from. However, I don't get any
> duplicates at all if I run XWin directly, instead of starting it with
> startxwin.bat.
...isn't the sole candidates. Check the manuals of involved shells for which
files they read at startup, under which conditions, and how. .bashrc, .profile
and corresponding files under /etc are prime candidates.
This isn't Cygwin or Cygwin/X specific though, but general Unix behaviour.
Cheers
--
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
- Raw text -