Postinstall for mintty fails when installing "just for me"

2010-08-16 Thread Buchbinder, Barry (NIH/NIAID) [E]
$ bash --norc --noprofile /etc/postinstall/mintty.sh
/bin/mkdir: cannot create directory `/c/Documents and Settings/All Users/Start 
Menu/Programs/Cygwin': Permission denied
mkshortcut: Saving "C:\Documents and Settings\All Users\Start 
Menu\Programs\Cygwin\mintty.lnk" failed; does the target directory exist?
/bin/chmod: cannot access `/c/Documents and Settings/All Users/Start 
Menu/Programs/Cygwin/mintty.lnk': No such file or directory
echo $?
1

Thanks,

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-16 Thread Andy Koppe
On 17 August 2010 02:26, Buchbinder, Barry wrote:
> $ bash --norc --noprofile /etc/postinstall/mintty.sh
> /bin/mkdir: cannot create directory `/c/Documents and Settings/All 
> Users/Start Menu/Programs/Cygwin': Permission denied
> mkshortcut: Saving "C:\Documents and Settings\All Users\Start 
> Menu\Programs\Cygwin\mintty.lnk" failed; does the target directory exist?
> /bin/chmod: cannot access `/c/Documents and Settings/All Users/Start 
> Menu/Programs/Cygwin/mintty.lnk': No such file or directory
> echo $?
> 1

Hmm, the test at the top of the script is meant to avoid that, by
checking whether the 'All Users/Start Menu/Programs' folder is
writable. Any idea why that's saying yes when apparently it isn't
writable?

Is there a proper way for a postinstall script to find out whether
it's an install for all users or "Just Me"?

Here's the script for reference:

PROGS=$(/bin/cygpath -AP)
if [ -w "$PROGS" ]; then
  /bin/mkdir -p "$PROGS/Cygwin"
  /bin/mkshortcut -AP -n Cygwin/mintty -a - -d Terminal /bin/mintty.exe
  /bin/chmod a+r "$PROGS/Cygwin/mintty.lnk"
else
  /bin/mkdir -p "$(/bin/cygpath -P)/Cygwin"
  /bin/mkshortcut -P -n Cygwin/mintty -a - -d Terminal /bin/mintty.exe
fi

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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-17 Thread Corinna Vinschen
On Aug 17 06:52, Andy Koppe wrote:
> On 17 August 2010 02:26, Buchbinder, Barry wrote:
> > $ bash --norc --noprofile /etc/postinstall/mintty.sh
> > /bin/mkdir: cannot create directory `/c/Documents and Settings/All 
> > Users/Start Menu/Programs/Cygwin': Permission denied
> > mkshortcut: Saving "C:\Documents and Settings\All Users\Start 
> > Menu\Programs\Cygwin\mintty.lnk" failed; does the target directory exist?
> > /bin/chmod: cannot access `/c/Documents and Settings/All Users/Start 
> > Menu/Programs/Cygwin/mintty.lnk': No such file or directory
> > echo $?
> > 1
> 
> Hmm, the test at the top of the script is meant to avoid that, by
> checking whether the 'All Users/Start Menu/Programs' folder is
> writable. Any idea why that's saying yes when apparently it isn't
> writable?

I tried your script and it works fine for me.  If I'm running as
admin in a UAC-restricted shell, the test fails as expected.

The problem is, we don't know anything about your environment, Barry.
cygcheck output as requested by http://cygwin.com/problems.html
would be helpful, perhaps.  As is getfacl/cacls output for the
"/c/Documents and Settings/All Users/Start Menu/Programs" directory.

> Is there a proper way for a postinstall script to find out whether
> it's an install for all users or "Just Me"?

Hmm, afaik no.

You could try to write to All Users first and if that fails, write to
the user's own Programs.  Or, you could combine this with a call to `id
-G' and test if the group 544 is in the users supplementary group list.

But, maybe we should define a couple of useful, installation-specific
arguments for postinstall scripts and change setup accordingly?


Corinna

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

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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-17 Thread Andy Koppe
On 17 August 2010 20:12, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Corinna Vinschen sent the following at Tuesday, August 17, 2010 4:49 AM
>>On Aug 17 06:52, Andy Koppe wrote:
>>> On 17 August 2010 02:26, Buchbinder, Barry wrote:
>>> > $ bash --norc --noprofile /etc/postinstall/mintty.sh
>>> > /bin/mkdir: cannot create directory `/c/Documents and Settings/All
>>> > Users/Start Menu/Programs/Cygwin': Permission denied
>>> > mkshortcut: Saving "C:\Documents and Settings\All Users\Start 
>>> > Menu\Programs\Cygwin\mintty.lnk" failed; does the target directory exist?
>>> > /bin/chmod: cannot access `/c/Documents and Settings/All Users/Start
>>> > Menu/Programs/Cygwin/mintty.lnk': No such file or directory echo $?
>>> > 1
>>>
>>> Hmm, the test at the top of the script is meant to avoid that, by
>>> checking whether the 'All Users/Start Menu/Programs' folder is
>>> writable. Any idea why that's saying yes when apparently it isn't
>>> writable?
>>
>>I tried your script and it works fine for me. If I'm running as admin in
>>a UAC-restricted shell, the test fails as expected.
>>
>>The problem is, we don't know anything about your environment, Barry.
>>cygcheck output as requested by http://cygwin.com/problems.html would be
>>helpful, perhaps.
>
> Attached.

Thanks.


> Please note:
>
> $ cygcheck -s -v -r > cygcheck.out
> /usr/bin/cygrunsrv: warning: OpenService failed for 'TapiSrv': Win32 error 5
> Access is denied.
>
>>As is getfacl/cacls output for the "/c/Documents and
>>Settings/All Users/Start Menu/Programs" directory.
>
> $ getfacl '/c/Documents and Settings/All Users/Start Menu/Programs'
> # file: /c/Documents and Settings/All Users/Start Menu/Programs
> # owner: BBuchbinder
> # group: Domain Users
> user::rwx
> group::r-x
> other:r-x
> mask:rwx

Hmm, so you've got 'rwx' permissions on that directory yet you can't
create a directory in it. That just leaves me puzzled.


> $ cacls 'C:\Documents and Settings\All Users\Start Menu\Programs'
> C:\Documents and Settings\All Users\Start Menu\Programs 
> BUILTIN\Administrators:(OI)(CI)F
>                                                        CREATOR 
> OWNER:(OI)(CI)(IO)F
>                                                        NT 
> AUTHORITY\SYSTEM:(OI)(CI)F
>                                                        BUILTIN\Users:(OI)(CI)R

Not knowing enough about ACLs: does the BUILTIN\Users, which says
read-only, override the CREATOR OWNER entry, which grants full access?


>>> Is there a proper way for a postinstall script to find out whether
>>> it's an install for all users or "Just Me"?
>>
>>Hmm, afaik no.
>>
>>You could try to write to All Users first and if that fails, write to
>>the user's own Programs.

Sounds like the way to go (for the moment anyway), especially now that
mkshortcut correctly reports success.


>>But, maybe we should define a couple of useful, installation-specific
>>arguments for postinstall scripts and change setup accordingly?

I think that would be useful. Looking at the source in script.cc, the
Cygwin root is passed as a variable already.


> I should have started by saying that, as a practical matter, this
> is not a problem for me.  I have a minty shortcut and renaming
> /etc/postinstall/minty.sh to /etc/postinstall/minty.sh.done stops
> the error message from coming up.

Yep, that's the right workaround.


> And thanks for this upgrade of setup.  For some time now the
> "pending" view had the same two empty packages appear each time
> I ran setup.  Very annoying.  Now, they no longer show up.

Dave Korn fixed that one. A relief indeed.

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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-18 Thread Corinna Vinschen
On Aug 17 15:12, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Corinna Vinschen sent the following at Tuesday, August 17, 2010 4:49 AM
> >> On 17 August 2010 02:26, Buchbinder, Barry wrote:
> >> > $ bash --norc --noprofile /etc/postinstall/mintty.sh
> >> > /bin/mkdir: cannot create directory `/c/Documents and Settings/All
> >> > Users/Start Menu/Programs/Cygwin': Permission denied
> >> > mkshortcut: Saving "C:\Documents and Settings\All Users\Start 
> >> > Menu\Programs\Cygwin\mintty.lnk" failed; does the target directory exist?
> >> > /bin/chmod: cannot access `/c/Documents and Settings/All Users/Start
> >> > Menu/Programs/Cygwin/mintty.lnk': No such file or directory echo $?
> >> > 1
> >[...]
> >The problem is, we don't know anything about your environment, Barry.
> >cygcheck output as requested by http://cygwin.com/problems.html would be
> >helpful, perhaps.
> 
> Attached.
> 
> Please note:
> 
> $ cygcheck -s -v -r > cygcheck.out
> /usr/bin/cygrunsrv: warning: OpenService failed for 'TapiSrv': Win32 error 5
> Access is denied.

That usually just means you don't have admin privs.

> 
> >As is getfacl/cacls output for the "/c/Documents and
> >Settings/All Users/Start Menu/Programs" directory.
> 
> $ getfacl '/c/Documents and Settings/All Users/Start Menu/Programs'
> # file: /c/Documents and Settings/All Users/Start Menu/Programs
> # owner: BBuchbinder
> # group: Domain Users
> user::rwx
> group::r-x
> other:r-x
> mask:rwx
> 
> $ cacls 'C:\Documents and Settings\All Users\Start Menu\Programs'
> C:\Documents and Settings\All Users\Start Menu\Programs 
> BUILTIN\Administrators:(OI)(CI)F
> CREATOR 
> OWNER:(OI)(CI)(IO)F
> NT 
> AUTHORITY\SYSTEM:(OI)(CI)F
> 
> BUILTIN\Users:(OI)(CI)R
>[...]

Here's the actual problem:

  cygdrive prefix / system  binary,noacl,posix=0,auto

The cygdrive prefix is set to the mount option "noacl".  So the output
from getfacl or ls or stat for this directory shows just fake
permissions based on the DOS R/O flag.

You're not an admin, so you're not allowed to write to this directory,
see the cacls output.  However, since the cygdrive prefix is mounted
with "noacl", Cygwin tools just don't know it.

Andy, to workaround this, you *could* create a user mount first which
has no "noacl", then use the user mount to check permissions, and
eventually umount again.  Like this:

  PROGS=/tmp/.mintty-postinstall-$$
  mount -f "`cygpath -APm`" $PROGS
  if [ -w "$PROGS" ]; then
[...]
  else
[...]
  fi
  umount $PROGS


Corinna

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

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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-18 Thread Andy Koppe
On 18 August 2010 09:43, Corinna Vinschen wrote:
> On Aug 17 15:12, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>> Corinna Vinschen sent the following at Tuesday, August 17, 2010 4:49 AM
>> >> On 17 August 2010 02:26, Buchbinder, Barry wrote:
>> >> > $ bash --norc --noprofile /etc/postinstall/mintty.sh
>> >> > /bin/mkdir: cannot create directory `/c/Documents and Settings/All
>> >> > Users/Start Menu/Programs/Cygwin': Permission denied
>> >> > mkshortcut: Saving "C:\Documents and Settings\All Users\Start 
>> >> > Menu\Programs\Cygwin\mintty.lnk" failed; does the target directory 
>> >> > exist?
>> >> > /bin/chmod: cannot access `/c/Documents and Settings/All Users/Start
>> >> > Menu/Programs/Cygwin/mintty.lnk': No such file or directory echo $?
>> >> > 1
>> >[...]
>> >The problem is, we don't know anything about your environment, Barry.
>> >cygcheck output as requested by http://cygwin.com/problems.html would be
>> >helpful, perhaps.
>>
>> Attached.
>>
>> Please note:
>>
>> $ cygcheck -s -v -r > cygcheck.out
>> /usr/bin/cygrunsrv: warning: OpenService failed for 'TapiSrv': Win32 error 5
>> Access is denied.
>
> That usually just means you don't have admin privs.
>
>>
>> >As is getfacl/cacls output for the "/c/Documents and
>> >Settings/All Users/Start Menu/Programs" directory.
>>
>> $ getfacl '/c/Documents and Settings/All Users/Start Menu/Programs'
>> # file: /c/Documents and Settings/All Users/Start Menu/Programs
>> # owner: BBuchbinder
>> # group: Domain Users
>> user::rwx
>> group::r-x
>> other:r-x
>> mask:rwx
>>
>> $ cacls 'C:\Documents and Settings\All Users\Start Menu\Programs'
>> C:\Documents and Settings\All Users\Start Menu\Programs 
>> BUILTIN\Administrators:(OI)(CI)F
>>                                                         CREATOR 
>> OWNER:(OI)(CI)(IO)F
>>                                                         NT 
>> AUTHORITY\SYSTEM:(OI)(CI)F
>>                                                         
>> BUILTIN\Users:(OI)(CI)R
>>[...]
>
> Here's the actual problem:
>
>  cygdrive prefix     /         system  binary,noacl,posix=0,auto
>
> The cygdrive prefix is set to the mount option "noacl".  So the output
> from getfacl or ls or stat for this directory shows just fake
> permissions based on the DOS R/O flag.

Thanks very much for spotting that.


> You're not an admin, so you're not allowed to write to this directory,
> see the cacls output.  However, since the cygdrive prefix is mounted
> with "noacl", Cygwin tools just don't know it.
>
> Andy, to workaround this, you *could* create a user mount first which
> has no "noacl", then use the user mount to check permissions, and
> eventually umount again.  Like this:
>
>  PROGS=/tmp/.mintty-postinstall-$$
>  mount -f "`cygpath -APm`" $PROGS
>  if [ -w "$PROGS" ]; then
>    [...]
>  else
>    [...]
>  fi
>  umount $PROGS

Hmm, I'm a bit afraid that might find creative new ways of going wrong. ;)

I think I'll go with your previous suggestion of just going ahead and
trying to create the 'All Users' shortcut and falling back to the
user's start menu if that fails.

Although, perhaps there's a way to tell from $CYGWINROOT whether we're
dealing with an install for all users or "just me"?

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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-18 Thread Corinna Vinschen
On Aug 18 12:24, Andy Koppe wrote:
> On 18 August 2010 09:43, Corinna Vinschen wrote:
> > Andy, to workaround this, you *could* create a user mount first which
> > has no "noacl", then use the user mount to check permissions, and
> > eventually umount again.  Like this:
> >
> >  PROGS=/tmp/.mintty-postinstall-$$
> >  mount -f "`cygpath -APm`" $PROGS
> >  if [ -w "$PROGS" ]; then
> >    [...]
> >  else
> >    [...]
> >  fi
> >  umount $PROGS
> 
> Hmm, I'm a bit afraid that might find creative new ways of going wrong. ;)

The only way that could go wrong is, if the user already has 30 mount
points, since that's the current maximum nuber of allowed mounts.

> I think I'll go with your previous suggestion of just going ahead and
> trying to create the 'All Users' shortcut and falling back to the
> user's start menu if that fails.
> 
> Although, perhaps there's a way to tell from $CYGWINROOT whether we're
> dealing with an install for all users or "just me"?

No, but I don't think it would hurt to enhance setup.exe, either by
adding arguments to postinstall/preremove scripts, or by adding an
environment variable like $CYGWIN_AUDIENCE with the values "all_user" or
"just_me".


Corinna

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

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



Re: Postinstall for mintty fails when installing "just for me"

2010-08-18 Thread Corinna Vinschen
On Aug 18 13:35, Corinna Vinschen wrote:
> On Aug 18 12:24, Andy Koppe wrote:
> > On 18 August 2010 09:43, Corinna Vinschen wrote:
> > > Andy, to workaround this, you *could* create a user mount first which
> > > has no "noacl", then use the user mount to check permissions, and
> > > eventually umount again.  Like this:
> > >
> > >  PROGS=/tmp/.mintty-postinstall-$$
> > >  mount -f "`cygpath -APm`" $PROGS
> > >  if [ -w "$PROGS" ]; then
> > >    [...]
> > >  else
> > >    [...]
> > >  fi
> > >  umount $PROGS
> > 
> > Hmm, I'm a bit afraid that might find creative new ways of going wrong. ;)
> 
> The only way that could go wrong is, if the user already has 30 mount
> points, since that's the current maximum nuber of allowed mounts.

Btw., see /bin/ssh-host-config, line 93 :)


Corinna

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

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



RE: Postinstall for mintty fails when installing "just for me"

2010-08-18 Thread Buchbinder, Barry (NIH/NIAID) [E]
Corinna Vinschen sent the following at Wednesday, August 18, 2010 4:43 AM
>
>That usually just means you don't have admin privs.

For the archive:  That is indeed the case.

>Here's the actual problem:
>  cygdrive prefix / system  binary,noacl,posix=0,auto
>
>The cygdrive prefix is set to the mount option "noacl".  So the
>output from getfacl or ls or stat for this directory shows just fake
>permissions based on the DOS R/O flag.
>
>You're not an admin, so you're not allowed to write to this directory,
>see the cacls output.  However, since the cygdrive prefix is mounted
>with "noacl", Cygwin tools just don't know it.

With "acl", I had been getting annoying error messages about copying
permissions with "cp -p" on some network drives, so I switched
everything to "noacl".  I'll try switching back to "acl", testing for
error messages, and going to "noacl" only on drives that seem to have
problems.

Thanks for your input.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


Re: Postinstall for mintty fails when installing "just for me"

2010-08-19 Thread Corinna Vinschen
On Aug 18 20:31, Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Corinna Vinschen sent the following at Wednesday, August 18, 2010 4:43 AM
> >
> >That usually just means you don't have admin privs.
> 
> For the archive:  That is indeed the case.
> 
> >Here's the actual problem:
> >  cygdrive prefix / system  binary,noacl,posix=0,auto
> >
> >The cygdrive prefix is set to the mount option "noacl".  So the
> >output from getfacl or ls or stat for this directory shows just fake
> >permissions based on the DOS R/O flag.
> >
> >You're not an admin, so you're not allowed to write to this directory,
> >see the cacls output.  However, since the cygdrive prefix is mounted
> >with "noacl", Cygwin tools just don't know it.
> 
> With "acl", I had been getting annoying error messages about copying
> permissions with "cp -p" on some network drives, so I switched
> everything to "noacl".  I'll try switching back to "acl", testing for
> error messages, and going to "noacl" only on drives that seem to have
> problems.

Oh, I didn't say you have to go back to "acl".  I was just pointing out
the fact.

The fact that "noacl" is perfectly valid is something we package
maintainers have to keep in mind when creating postinstall scripts.
Same for case-sensitivity.  *make mental note*


Corinna

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

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