public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* mkshortcut --allusers --smprograms
@ 2009-06-29 20:20 Andy Koppe
  2010-08-15 21:12 ` Charles Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Koppe @ 2009-06-29 20:20 UTC (permalink / raw)
  To: cygwin

Shortcuts created by postinstall scripts using mkshortcut --allusers
--smprograms aren't readable for ordinary users, so all they get to
see in the start menu is a white dummy icon that doesn't do anything.
This affects both MinTTY and rxvt, at least with Cygwin 1.7 on Windows
7. I guess the scripts could find out where the start menu is and
apply the necessary rights themselves, but it would make sense and be
much more convenient if mkshortcut did that.

Andy

--
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

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

* Re: mkshortcut --allusers --smprograms
  2009-06-29 20:20 mkshortcut --allusers --smprograms Andy Koppe
@ 2010-08-15 21:12 ` Charles Wilson
  2011-04-21 19:38   ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Wilson @ 2010-08-15 21:12 UTC (permalink / raw)
  To: cygwin

On 6/29/2009 2:53 PM, Andy Koppe wrote:
> Shortcuts created by postinstall scripts using mkshortcut --allusers
> --smprograms aren't readable for ordinary users, so all they get to
> see in the start menu is a white dummy icon that doesn't do anything.
> This affects both MinTTY and rxvt, at least with Cygwin 1.7 on Windows
> 7. I guess the scripts could find out where the start menu is and
> apply the necessary rights themselves, but it would make sense and be
> much more convenient if mkshortcut did that.

Andy, if you'd like to roll this change into a forward-port of your
other, wideAPI/locale patch, that'd be great.

--
Chuck

--
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

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

* Re: mkshortcut --allusers --smprograms
  2010-08-15 21:12 ` Charles Wilson
@ 2011-04-21 19:38   ` Jon TURNEY
  2011-04-28 21:45     ` Charles Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2011-04-21 19:38 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On 15/08/2010 22:12, Charles Wilson wrote:
> On 6/29/2009 2:53 PM, Andy Koppe wrote:
>> Shortcuts created by postinstall scripts using mkshortcut --allusers
>> --smprograms aren't readable for ordinary users, so all they get to
>> see in the start menu is a white dummy icon that doesn't do anything.
>> This affects both MinTTY and rxvt, at least with Cygwin 1.7 on Windows
>> 7. I guess the scripts could find out where the start menu is and
>> apply the necessary rights themselves, but it would make sense and be
>> much more convenient if mkshortcut did that.
> 
> Andy, if you'd like to roll this change into a forward-port of your
> other, wideAPI/locale patch, that'd be great.

This issue still seems to exist, and I couldn't find an actual patch to solve
it, so attached is an attempt at fixing this.

[-- Attachment #2: mkshortcut_permissions.patch --]
[-- Type: text/plain, Size: 2116 bytes --]

2011-04-21  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* src/mkshortcut/mkshortcut.c (mkshortcut): If we are
	creating shortcut for all users, ensure it is readable by
	all users.

Index: src/mkshortcut/mkshortcut.c
===================================================================
RCS file: /cvs/cygwin-apps/cygutils/src/mkshortcut/mkshortcut.c,v
retrieving revision 1.13
diff -u -r1.13 mkshortcut.c
--- src/mkshortcut/mkshortcut.c	18 Aug 2010 17:22:36 -0000	1.13
+++ src/mkshortcut/mkshortcut.c	21 Apr 2011 14:12:27 -0000
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include <popt.h>
 */
+#include <sys/cygwin.h>
 
 static const char versionID[] = PACKAGE_VERSION;
 static const char revID[] =
@@ -611,6 +612,35 @@
             }
           persist_file->lpVtbl->Release (persist_file);
           shell_link->lpVtbl->Release (shell_link);
+
+          /* If we are creating shortcut for all users, ensure it is readable by all users */
+          if (opts.allusers_flag)
+            {
+              ssize_t size;
+              size = cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath, NULL, 0);
+              if (size >= 0)
+                {
+                  char *posixpath = malloc(size);
+                  if (!cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath, posixpath, size))
+                    {
+                      struct stat statbuf;
+                      if (stat(posixpath, &statbuf))
+                        {
+                          fprintf (stderr,
+                                   "%s: stat \"%s\" failed\n",
+                                   program_name, posixpath);
+                        }
+                      else if (chmod(posixpath, statbuf.st_mode|S_IRUSR|S_IRGRP|S_IROTH))
+                        {
+                          fprintf (stderr,
+                                   "%s: chmod \"%s\" failed\n",
+                                   program_name, posixpath);
+                        }
+                    }
+                  free(posixpath);
+                }
+            }
+
           return (0);
         }
       else

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
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

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

* Re: mkshortcut --allusers --smprograms
  2011-04-21 19:38   ` Jon TURNEY
@ 2011-04-28 21:45     ` Charles Wilson
  2011-04-29  3:55       ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Wilson @ 2011-04-28 21:45 UTC (permalink / raw)
  To: cygwin

On 4/21/2011 10:18 AM, Jon TURNEY wrote:
> On 15/08/2010 22:12, Charles Wilson wrote:
>> On 6/29/2009 2:53 PM, Andy Koppe wrote:
>>> Shortcuts created by postinstall scripts using mkshortcut --allusers
>>> --smprograms aren't readable for ordinary users, so all they get to
>>> see in the start menu is a white dummy icon that doesn't do anything.
>>> This affects both MinTTY and rxvt, at least with Cygwin 1.7 on Windows
>>> 7. I guess the scripts could find out where the start menu is and
>>> apply the necessary rights themselves, but it would make sense and be
>>> much more convenient if mkshortcut did that.
>>
>> Andy, if you'd like to roll this change into a forward-port of your
>> other, wideAPI/locale patch, that'd be great.
> 
> This issue still seems to exist, and I couldn't find an actual patch to solve
> it, so attached is an attempt at fixing this.
> 

Jon, thanks for the patch.  Out of curiosity, why do you do this:

ssize_t size;
size = cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath,
NULL, 0);
if (size >= 0)
{
   char *posixpath = malloc(size);
   if (!cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath,
posixpath, size))

Instead of simply using cygwin_create_path() ?

--
Chuck

--
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

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

* Re: mkshortcut --allusers --smprograms
  2011-04-28 21:45     ` Charles Wilson
@ 2011-04-29  3:55       ` Jon TURNEY
  0 siblings, 0 replies; 5+ messages in thread
From: Jon TURNEY @ 2011-04-29  3:55 UTC (permalink / raw)
  To: cygwin

On 28/04/2011 18:03, Charles Wilson wrote:
> On 4/21/2011 10:18 AM, Jon TURNEY wrote:
>> On 15/08/2010 22:12, Charles Wilson wrote:
>>> On 6/29/2009 2:53 PM, Andy Koppe wrote:
>>>> Shortcuts created by postinstall scripts using mkshortcut --allusers
>>>> --smprograms aren't readable for ordinary users, so all they get to
>>>> see in the start menu is a white dummy icon that doesn't do anything.
>>>> This affects both MinTTY and rxvt, at least with Cygwin 1.7 on Windows
>>>> 7. I guess the scripts could find out where the start menu is and
>>>> apply the necessary rights themselves, but it would make sense and be
>>>> much more convenient if mkshortcut did that.
>>>
>>> Andy, if you'd like to roll this change into a forward-port of your
>>> other, wideAPI/locale patch, that'd be great.
>>
>> This issue still seems to exist, and I couldn't find an actual patch to solve
>> it, so attached is an attempt at fixing this.
>>
> 
> Jon, thanks for the patch.  Out of curiosity, why do you do this:
> 
> ssize_t size;
> size = cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath,
> NULL, 0);
> if (size >= 0)
> {
>    char *posixpath = malloc(size);
>    if (!cygwin_conv_path(CCP_WIN_W_TO_POSIX | CCP_ABSOLUTE, widepath,
> posixpath, size))
> 
> Instead of simply using cygwin_create_path() ?

Doh! I obviously didn't get that far down the page :-)

--
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

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

end of thread, other threads:[~2011-04-28 17:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-29 20:20 mkshortcut --allusers --smprograms Andy Koppe
2010-08-15 21:12 ` Charles Wilson
2011-04-21 19:38   ` Jon TURNEY
2011-04-28 21:45     ` Charles Wilson
2011-04-29  3:55       ` Jon TURNEY

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).