This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mkshortcut (cygutils-1.4.14) free error

On Mon, Oct 26, 2015, at 03:54 PM, Mark Geisert wrote:
> There are configure errors from this process, at least on my
> machine. I'll take on maintenance of this package.  Give me a short
> while to get my sea legs.  Thanks Ken for the pointers and Corinna
> for the nudge.

Thanks Mark.   I would try to suggest you beat me to the punch but the
truth is you're much more noble.

I didn't hit any explicit configure issue myself,  rather a bunch of
unrecognized case-invariant strcmp variants, which took about 10 seconds
to fix but did make me wonder about the source code.    And then this
below was the slightly trickier issue:

% src/mkshortcut/.libs/mkshortcut xyzzy
mkshortcut: Saving "xyzzy.lnk" failed; does the target directory exist?

The packaged binary does not do this.

Fiddling about with various command-line flags suggests the issue is
with saving the link to a non-absolute path;  Google sort of vaguely
implies that IPersistFile may have changed semantics starting in Windows
8, but the docs I have say the Save() path should be absolute.   So I
added the minimal patch below.   At least, I think it's minimal, but I'd
certainly defer to you as the new maintainer!    Anyhow, attached below
fwiw in case it's of any help.



--- mkshortcut.c.orig   2015-10-17 21:57:08.000000000 -0400
+++ mkshortcut.c        2015-10-17 23:52:50.723030500 -0400
@@ -421,6 +421,7 @@
   IShellLink *shell_link;
   IPersistFile *persist_file;
   WCHAR widepath[MAX_PATH];
+  char link_path[MAX_PATH];
   /*  If there's a colon in the TARGET, it should be a URL */
   if (strchr (opts.target_arg, ':') != NULL)
@@ -596,6 +598,14 @@
       free (buf_str);
+  hres = GetFullPathName(link_name, sizeof(link_path), link_path, 0);
+  if (hres == 0) {
+      fprintf (stderr, "%s: Could not qualify link name\n",
+      return 2;
+  }
+  free (link_name);
+  link_name = xstrndup(link_path, strlen(link_path));
   /* Setup description text */
   if (opts.desc_arg != NULL)

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]