This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: mkshortcut (cygutils-1.4.14) free error
- From: Anthony Heading <anthony at ajrh dot net>
- To: Mark Geisert <mark at maxrnd dot com>, cygwin at cygwin dot com
- Date: Mon, 26 Oct 2015 20:11:48 -0400
- Subject: Re: mkshortcut (cygutils-1.4.14) free error
- Authentication-results: sourceware.org; auth=none
- References: <1445135414 dot 3384650 dot 413058409 dot 46BC94AD at webmail dot messagingengine dot com> <1445823930 dot 241438 dot 419951441 dot 109BA262 at webmail dot messagingengine dot com> <562E30AF dot 5020502 at cornell dot edu> <loom dot 20151026T205200-829 at post dot gmane dot org>
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.
Rgds
Anthony
--- 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",
program_name);
+ return 2;
+ }
+ free (link_name);
+ link_name = xstrndup(link_path, strlen(link_path));
+
/* Setup description text */
if (opts.desc_arg != NULL)
{
--
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