public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise
@ 2017-12-20 15:36 Enrique Perez-Terron
  2017-12-20 16:37 ` Eric Blake
  2017-12-20 23:35 ` Brian Inglis
  0 siblings, 2 replies; 3+ messages in thread
From: Enrique Perez-Terron @ 2017-12-20 15:36 UTC (permalink / raw)
  To: cygwin

Lately, whenever I run setup (x86), my /var/log/setup.log.full contains:

  2017/12/20 03:07:44 running: C:\cygwin\bin\bash.exe --norc --noprofile 
"/etc/postinstall/cygwin-doc.sh"
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/User Guide (PDF).lnk" failed; does the target 
directory exist?
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/User Guide (HTML).lnk" failed; does the target 
directory exist?
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/API (PDF).lnk" failed; does the target directory 
exist?
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/API (HTML).lnk" failed; does the target 
directory exist?
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/Home Page.lnk" failed; does the target directory 
exist?
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/FAQ.lnk" failed; does the target directory 
exist?
  2017/12/20 03:07:45 abnormal exit: exit code=3

Please notice the extra C:/ in front of the target link name.

So I have added a line "set -x" at the top in  
postinstall/cygwin-doc.sh, and the relevant section becomes

  + read target name desc
  + '[' -r ']'
  + /bin/mkshortcut -A -P -n 'Cygwin/User Guide (PDF)' -d 'Cygwin User 
Guide PDF' -- /usr/share/doc/cygwin-doc/cygwin-ug-net.pdf
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/User Guide (PDF).lnk" failed; does the target 
directory exist?
  + read target name desc
  + '[' -r ']'
  + /bin/mkshortcut -A -P -n 'Cygwin/User Guide (HTML)' -d 'Cygwin User 
Guide HTML' -- /usr/share/doc/cygwin-doc/html/cygwin-ug-net/index.html
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/User Guide (HTML).lnk" failed; does the target 
directory exist?
  + read target name desc
  + '[' -r ']'
  + /bin/mkshortcut -A -P -n 'Cygwin/API (PDF)' -d 'Cygwin API Reference 
PDF' -- /usr/share/doc/cygwin-doc/cygwin-api.pdf
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/API (PDF).lnk" failed; does the target directory 
exist?
  + read target name desc
  + '[' -r ']'
  + /bin/mkshortcut -A -P -n 'Cygwin/API (HTML)' -d 'Cygwin API Reference 
HTML' -- /usr/share/doc/cygwin-doc/html/cygwin-api/index.html
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/API (HTML).lnk" failed; does the target 
directory exist?
  + read target name desc
  + read target name desc
  + /bin/mkshortcut -A -P -n 'Cygwin/Home Page' -d 'Cygwin Home Page 
Link' -a https://cygwin.com/index.html -- /bin/cygstart
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/Home Page.lnk" failed; does the target directory 
exist?
  + read target name desc
  + /bin/mkshortcut -A -P -n Cygwin/FAQ -d 'Cygwin Frequently Asked 
Questions Link' -a https://cygwin.com/faq.html -- /bin/cygstart
  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/C:/cygwin/FAQ.lnk" failed; does the target directory 
exist?


(by the way -- this reveals another bug too: The script says "[ -r $t ] 
&& $mks ..." where I am sure it should be "[ -r $target ] && $mks ...")
(and again btw, I am not sure bash should count "[ -r ]" as a true 
statement)



The script issues mkshortcut commands with sane arguments, no extra 
"C:/" in there.

So I just tried to run the script from an elevated-privilege mintty 
shell:

  $ CYGWINFORALL=-A /bin/bash /etc/postinstall/cygwin-doc.sh

But then it does NOT fail, and the shortcuts do get installed -- they 
were not present before.


I am still running the 32-bit cygwin, though on a 64-bit windows 10 Home 
edition, version 1709, OS build 16299.125.

Any ideas about what could be the problem?

-Enrique

--
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] 3+ messages in thread

* Re: mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise
  2017-12-20 15:36 mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise Enrique Perez-Terron
@ 2017-12-20 16:37 ` Eric Blake
  2017-12-20 23:35 ` Brian Inglis
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2017-12-20 16:37 UTC (permalink / raw)
  To: cygwin

On 12/20/2017 06:59 AM, Enrique Perez-Terron wrote:

> So I have added a line "set -x" at the top in postinstall/cygwin-doc.sh, 
> and the relevant section becomes
> 
>   + read target name desc
>   + '[' -r ']'

> 
> 
> (by the way -- this reveals another bug too: The script says "[ -r $t ] 
> && $mks ..." where I am sure it should be "[ -r $target ] && $mks ...")

Or, rather,

[ -r "$target" ]

It is almost always a bug to use [ ] without quoting "$..." expansions, 
because if the expansion of $... is empty, it changes the number of 
arguments to [ and thus the test that [ performs.

If your script uses #!/bin/bash, then you can use bashisms like:

[[ -r $target ]]

which do the right thing ('[[' is part of the shell grammar, rather than 
treated like an executable; as such, you can safely omit quoting in that 
form; but '[[' is not yet POSIX and is not supported on dash).

> (and again btw, I am not sure bash should count "[ -r ]" as a true 
> statement)

I am.  POSIX requires that behavior.  Any time you have exactly one 
argument to '[', the result is true unless that argument was the empty 
string.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
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] 3+ messages in thread

* Re: mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise
  2017-12-20 15:36 mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise Enrique Perez-Terron
  2017-12-20 16:37 ` Eric Blake
@ 2017-12-20 23:35 ` Brian Inglis
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Inglis @ 2017-12-20 23:35 UTC (permalink / raw)
  To: cygwin

On 2017-12-20 05:59, Enrique Perez-Terron wrote:
> Lately, whenever I run setup (x86), my /var/log/setup.log.full contains:
>  2017/12/20 03:07:44 running: C:\cygwin\bin\bash.exe --norc --noprofile
> "/etc/postinstall/cygwin-doc.sh"
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/User Guide (PDF).lnk" failed; does the target directory
> exist?
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/User Guide (HTML).lnk" failed; does the target directory
> exist?
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/API (PDF).lnk" failed; does the target directory exist?
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/API (HTML).lnk" failed; does the target directory exist?
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/Home Page.lnk" failed; does the target directory exist?
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/FAQ.lnk" failed; does the target directory exist?
>  2017/12/20 03:07:45 abnormal exit: exit code=3
> Please notice the extra C:/ in front of the target link name.
> So I have added a line "set -x" at the top in  postinstall/cygwin-doc.sh, and
> the relevant section becomes
>  + read target name desc
>  + '[' -r ']'
>  + /bin/mkshortcut -A -P -n 'Cygwin/User Guide (PDF)' -d 'Cygwin User Guide PDF'
> -- /usr/share/doc/cygwin-doc/cygwin-ug-net.pdf
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/User Guide (PDF).lnk" failed; does the target directory
> exist?
>  + read target name desc
>  + '[' -r ']'
>  + /bin/mkshortcut -A -P -n 'Cygwin/User Guide (HTML)' -d 'Cygwin User Guide
> HTML' -- /usr/share/doc/cygwin-doc/html/cygwin-ug-net/index.html
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/User Guide (HTML).lnk" failed; does the target directory
> exist?
>  + read target name desc
>  + '[' -r ']'
>  + /bin/mkshortcut -A -P -n 'Cygwin/API (PDF)' -d 'Cygwin API Reference PDF' --
> /usr/share/doc/cygwin-doc/cygwin-api.pdf
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/API (PDF).lnk" failed; does the target directory exist?
>  + read target name desc
>  + '[' -r ']'
>  + /bin/mkshortcut -A -P -n 'Cygwin/API (HTML)' -d 'Cygwin API Reference HTML'
> -- /usr/share/doc/cygwin-doc/html/cygwin-api/index.html
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/API (HTML).lnk" failed; does the target directory exist?
>  + read target name desc
>  + read target name desc
>  + /bin/mkshortcut -A -P -n 'Cygwin/Home Page' -d 'Cygwin Home Page Link' -a
> https://cygwin.com/index.html -- /bin/cygstart
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/Home Page.lnk" failed; does the target directory exist?
>  + read target name desc
>  + /bin/mkshortcut -A -P -n Cygwin/FAQ -d 'Cygwin Frequently Asked Questions
> Link' -a https://cygwin.com/faq.html -- /bin/cygstart
>  mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start
> Menu/Programs/C:/cygwin/FAQ.lnk" failed; does the target directory exist?
> (by the way -- this reveals another bug too: The script says "[ -r $t ] && $mks
> ..." where I am sure it should be "[ -r $target ] && $mks ...")
> (and again btw, I am not sure bash should count "[ -r ]" as a true statement)
> The script issues mkshortcut commands with sane arguments, no extra "C:/" in there.
> So I just tried to run the script from an elevated-privilege mintty shell:
>  $ CYGWINFORALL=-A /bin/bash /etc/postinstall/cygwin-doc.sh
> But then it does NOT fail, and the shortcuts do get installed -- they were not
> present before.

CYGWINFORALL=-A requires elevation or security changes to install for all users.
mkshortcut may be defaulting something incorrectly when -A -P is specified
without elevation?
Patch submitted for variable typo - thanks for catching and reporting.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
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] 3+ messages in thread

end of thread, other threads:[~2017-12-20 23:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-20 15:36 mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise Enrique Perez-Terron
2017-12-20 16:37 ` Eric Blake
2017-12-20 23:35 ` Brian Inglis

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