public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* which for cygwin 1.7
@ 2008-12-12 23:00 David Rothenberger
  2008-12-13  9:38 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: David Rothenberger @ 2008-12-12 23:00 UTC (permalink / raw)
  To: cygapps

I've been looking at rebuilding which for cygwin 1.7. I think there are 
a lot of problems with the current code. It uses static buffers of 
PATH_MAX all over the place, some of which are passed to getcwd().

My C programming skills are a bit rusty, but I can take a stab at fixing 
it. I'd appreciate it if someone else could take a quick look and let me 
know whether it's worth the effort or not.

I'm pretty sure that using a PATH_MAX sized buffer for getcwd() is a 
problem. These buffers are also used to hold output from getenv(). I'm 
not sure if that will be a problem or not.

I guess the alternative is to use a different which package. The one 
from Debian uses a shell script and does not have all the features of 
the current which.

Any suggestions would be appreciated, including if or how to patch the 
current which and alternative which packages to investigate.

-- 
David Rothenberger  ----  daveroth@acm.org

Hlade's Law:
         If you have a difficult task, give it to a lazy person --
         they will find an easier way to do it.

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

* Re: which for cygwin 1.7
  2008-12-12 23:00 which for cygwin 1.7 David Rothenberger
@ 2008-12-13  9:38 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2008-12-13  9:38 UTC (permalink / raw)
  To: cygwin-apps

On Dec 12 14:46, David Rothenberger wrote:
> I've been looking at rebuilding which for cygwin 1.7. I think there are a 
> lot of problems with the current code. It uses static buffers of PATH_MAX 
> all over the place, some of which are passed to getcwd().

For a start that would be fine.  By rebuilding you get static buffers
of the new PATH_MAX size.  As long as which checks if the path length
doesn't exceed the buffer size, it should be safe to use.  It wouldn't
work for paths > 4K, but that's a far way off.  Just check if it uses
strlen() > PATH_MAX or strncpy(a,b,PATH_MAX) sort of expressions.


Corinna

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

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

end of thread, other threads:[~2008-12-13  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-12 23:00 which for cygwin 1.7 David Rothenberger
2008-12-13  9:38 ` 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).