Mail Archives: cygwin/2010/12/31/14:00:23
------=_NextPart_000_0049_01CBA8F3.08657FE0
Content-Type: text/plain;
boundary="----=_NextPart_000_003A_01CBA8F2.E4688C40";
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Several people have reported problems with run.exe complaining about being
unable to execute programs.
The typical symptoms of the problem are that the user clicks on a link in
the Start menu that uses run.exe and gets back an error pop-up from run.exe
that looks like this:
Error could not start C:\cygwin\bin\emacs-X11.exe [some extra characters
here that shouldn=92t be] -display 127.0.0.1:0.0
I just encountered this issue and tracked down the root cause, which is that
run.exe doesn=92t null-terminate the data returned by readlink(). According=
to
the readlink(3) man page on Linux, =93Conforming applications should not
assume that the returned contents of the symbolic link are null-terminated,=
=94
and indeed, at least in some circumstances they are not.
I have attached a patch.
Share and enjoy. :-)
Thanks,
=A0 Jonathan Kamens
------=_NextPart_000_0049_01CBA8F3.08657FE0
Content-Type: application/octet-stream;
name="run-1.1.12-11.readlink.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="run-1.1.12-11.readlink.patch"
diff -rup run-1.1.12/src/run.c /tmp/run-1.1.12/src/run.c
--- old/run-1.1.12/src/run.c 2010-12-31 13:43:05.770732300 -0500
+++ run-1.1.12/src/run.c 2010-12-31 13:41:13.093732300 -0500
@@ -810,10 +810,16 @@ void process_execname(char *exec, const
{
if ((stbuf.st_mode & S_IFLNK) =3D=3D S_IFLNK)
{
- if (readlink(sym_link_name, real_name, sizeof(real_name)) =3D=3D -1)
+ ssize_t len;
+
+ if ((len =3D readlink(sym_link_name, real_name, sizeof(real_name))) =
=3D=3D -1)
error("problem reading symbolic link for %s",exec_tmp);
else
{
+ if (len < sizeof(real_name))
+ real_name[len] =3D '\0';
+ else
+ error("symlink pointed to by %s is too long", sym_link_name);
/* if realname starts with '/' it's a rootpath */
if (real_name[0] =3D=3D '/')
strcpy(exec_tmp2,real_name);
------=_NextPart_000_0049_01CBA8F3.08657FE0
Content-Type: text/plain; charset=us-ascii
--
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
------=_NextPart_000_0049_01CBA8F3.08657FE0--
- Raw text -