public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygwin-doc post install script failures
@ 2020-12-15  8:43 Marco Atzeri
  2020-12-15 20:03 ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Atzeri @ 2020-12-15  8:43 UTC (permalink / raw)
  To: cygwin

Not a recent bug but annoying anyway

It seems the post-install script is not considering that the
installation can be in a disk different from C: , properly
in this case D:


2020/12/15 08:40:13 running: d:\cygwin32\bin\bash.exe --norc --noprofile 
"/etc/postinstall/cygwin-doc.sh"
mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (PDF).lnk" failed; 
does the target directory exist?
mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (HTML).lnk" failed; 
does the target directory exist?


$ ls "/cygdrive/c/ProgramData/Microsoft/Windows/Start Menu/Programs/" | 
grep Cygwin
Cygwin
Cygwin (32-bit)

Regards
Marco

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

* Re: cygwin-doc post install script failures
  2020-12-15  8:43 cygwin-doc post install script failures Marco Atzeri
@ 2020-12-15 20:03 ` Brian Inglis
  2020-12-15 20:51   ` Marco Atzeri
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Inglis @ 2020-12-15 20:03 UTC (permalink / raw)
  To: cygwin

On 2020-12-15 01:43, Marco Atzeri via Cygwin wrote:
> Not a recent bug but annoying anyway
> 
> It seems the post-install script is not considering that the
> installation can be in a disk different from C: , properly
> in this case D:

The post-install script does not care as mkshortcut uses POSIX paths.
Could you please check your paths with:

	$ which -a mkshortcut
	/usr/bin/mkshortcut
	$ cygcheck mkshortcut
	Found: C:\...\cygwin64\bin\mkshortcut.exe
	C:\...\cygwin64\bin\mkshortcut.exe
	  C:\...\cygwin64\bin\cygwin1.dll
	    C:\Windows\system32\KERNEL32.dll
	      C:\Windows\system32\ntdll.dll
	      C:\Windows\system32\KERNELBASE.dll
	  C:\...\cygwin64\bin\cygpopt-0.dll
	    C:\...\cygwin64\bin\cygiconv-2.dll
	    C:\...\cygwin64\bin\cygintl-8.dll
	  C:\Windows\system32\ole32.dll
	    C:\Windows\system32\RPCRT4.dll
	    C:\Windows\system32\GDI32.dll
	      C:\Windows\system32\win32u.dll
	    C:\Windows\system32\USER32.dll
	    C:\Windows\system32\combase.dll
	      C:\Windows\system32\bcryptPrimitives.dll
	  C:\Windows\system32\SHELL32.dll
	$ cygcheck -f /usr/bin/mkshortcut
	cygutils-1.4.16-2
	$ cygcheck -c cygutils
	Cygwin Package Information
	Package              Version        Status
	cygutils             1.4.16-2       OK
	
> 2020/12/15 08:40:13 running: d:\cygwin32\bin\bash.exe --norc --noprofile 
> "/etc/postinstall/cygwin-doc.sh"
> mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
> Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (PDF).lnk" failed; does the 
> target directory exist?
> mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
> Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (HTML).lnk" failed; does 
> the target directory exist?

Please try:

	$ sh --version
	GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
	...

Could you please try rerunning the p-i script under sh -vx and post the output, 
as I can not see any way to rearrange the inputs and outputs to get that result, 
unless read or mkshortcut are damaged!

> $ ls "/cygdrive/c/ProgramData/Microsoft/Windows/Start Menu/Programs/" | grep Cygwin
> Cygwin
> Cygwin (32-bit)

$ ll "$(cygpath -A -P -U)"/Cygwin*

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

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]



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

* Re: cygwin-doc post install script failures
  2020-12-15 20:03 ` Brian Inglis
@ 2020-12-15 20:51   ` Marco Atzeri
  2020-12-16 22:53     ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Atzeri @ 2020-12-15 20:51 UTC (permalink / raw)
  To: cygwin

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

On 15.12.2020 21:03, Brian Inglis wrote:
> On 2020-12-15 01:43, Marco Atzeri via Cygwin wrote:
>> Not a recent bug but annoying anyway
>>
>> It seems the post-install script is not considering that the
>> installation can be in a disk different from C: , properly
>> in this case D:
> 
> The post-install script does not care as mkshortcut uses POSIX paths.
> Could you please check your paths with:
> 
>      $ which -a mkshortcut
>      /usr/bin/mkshortcut

all same

> 
>> 2020/12/15 08:40:13 running: d:\cygwin32\bin\bash.exe --norc 
>> --noprofile "/etc/postinstall/cygwin-doc.sh"
>> mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
>> Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (PDF).lnk" 
>> failed; does the target directory exist?
>> mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
>> Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (HTML).lnk" 
>> failed; does the target directory exist?
> 
> Please try:
> 
>      $ sh --version
>      GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
>      ...
> 
> Could you please try rerunning the p-i script under sh -vx and post the 
> output, as I can not see any way to rearrange the inputs and outputs to 
> get that result, unless read or mkshortcut are damaged!
> 
>> $ ls "/cygdrive/c/ProgramData/Microsoft/Windows/Start Menu/Programs/" 
>> | grep Cygwin
>> Cygwin
>> Cygwin (32-bit)
> 
> $ ll "$(cygpath -A -P -U)"/Cygwin*
> 

It works, but it is different from running under setup, as it is using

/proc/cygdrive/c/Users/Marco/AppData/Roaming/Microsoft/Windows/Start 
Menu/Programs/Cygwin (32-bit)/

attached log

Regards
Marco









[-- Attachment #2: post-cygwin-doc.log --]
[-- Type: text/plain, Size: 4230 bytes --]

#!/bin/sh
# /etc/postinstall/cygwin-doc.sh - cygwin-doc postinstall script.
# installs Cygwin Start Menu shortcuts for Cygwin User Guide and API PDF and
# HTML if in doc dir, and links to Cygwin web site home page and FAQ
#
# CYGWINFORALL=-A if install for All Users
# installs local shortcuts for All Users or Current User in
# {ProgramData,~/Appdata/Roaming}/Microsoft/Windows/Start Menu/Programs/Cygwin/
# exits quietly if directory does not exist as presumably no shortcuts desired

doc=/usr/share/doc/cygwin-doc
+ doc=/usr/share/doc/cygwin-doc
site=https://cygwin.com
+ site=https://cygwin.com
cygp=/usr/bin/cygpath
+ cygp=/usr/bin/cygpath
mks=/usr/bin/mkshortcut
+ mks=/usr/bin/mkshortcut
launch=/usr/bin/cygstart
+ launch=/usr/bin/cygstart

html=$doc/html
+ html=/usr/share/doc/cygwin-doc/html

# check source directories created
for d in $doc $html
do
	if [ ! -d "$d/" ]
	then
		echo "Can't find directory '$d'"
		exit 2
	fi
done
+ for d in $doc $html
+ '[' '!' -d /usr/share/doc/cygwin-doc/ ']'
+ for d in $doc $html
+ '[' '!' -d /usr/share/doc/cygwin-doc/html/ ']'

# check for programs
for p in $cygp $mks $launch
do
	if [ ! -x "$p" ]
	then
		echo "Can't find program '$p'"
		exit 2
	fi
done
+ for p in $cygp $mks $launch
+ '[' '!' -x /usr/bin/cygpath ']'
+ for p in $cygp $mks $launch
+ '[' '!' -x /usr/bin/mkshortcut ']'
+ for p in $cygp $mks $launch
+ '[' '!' -x /usr/bin/cygstart ']'

# Cygwin Start Menu directory
case $(uname -s) in *-WOW*) wow64=" (32-bit)" ;; esac
+ case $(uname -s) in
++ uname -s
+ wow64=' (32-bit)'
smpc_dir="$($cygp $CYGWINFORALL -P -U --)/Cygwin${wow64}"
++ /usr/bin/cygpath -P -U --
+ smpc_dir='/proc/cygdrive/c/Users/Marco/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Cygwin (32-bit)'

# ensure Cygwin Start Menu directory exists
/usr/bin/mkdir -p "$smpc_dir"
+ /usr/bin/mkdir -p '/proc/cygdrive/c/Users/Marco/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Cygwin (32-bit)'

# check Cygwin Start Menu directory writable
if [ ! -w "$smpc_dir/" ]
then
	echo "Can't write to directory '$smpc_dir'"
	exit 1
fi
+ '[' '!' -w '/proc/cygdrive/c/Users/Marco/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Cygwin (32-bit)/' ']'

# create User Guide and API PDF and HTML shortcuts
while read target name desc
do
	[ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -- $target
done <<EOF
$doc/cygwin-ug-net.pdf		User\ Guide\ \(PDF\)  Cygwin\ User\ Guide\ PDF
$html/cygwin-ug-net/index.html	User\ Guide\ \(HTML\) Cygwin\ User\ Guide\ HTML
$doc/cygwin-api.pdf		API\ \(PDF\)	Cygwin\ API\ Reference\ PDF
$html/cygwin-api/index.html	API\ \(HTML\)	Cygwin\ API\ Reference\ HTML
EOF
+ read target name desc
+ '[' -r /usr/share/doc/cygwin-doc/cygwin-ug-net.pdf ']'
+ /usr/bin/mkshortcut -P -n 'Cygwin (32-bit)/User Guide (PDF)' -d 'Cygwin User Guide PDF' -- /usr/share/doc/cygwin-doc/cygwin-ug-net.pdf
+ read target name desc
+ '[' -r /usr/share/doc/cygwin-doc/html/cygwin-ug-net/index.html ']'
+ /usr/bin/mkshortcut -P -n 'Cygwin (32-bit)/User Guide (HTML)' -d 'Cygwin User Guide HTML' -- /usr/share/doc/cygwin-doc/html/cygwin-ug-net/index.html
+ read target name desc
+ '[' -r /usr/share/doc/cygwin-doc/cygwin-api.pdf ']'
+ /usr/bin/mkshortcut -P -n 'Cygwin (32-bit)/API (PDF)' -d 'Cygwin API Reference PDF' -- /usr/share/doc/cygwin-doc/cygwin-api.pdf
+ read target name desc
+ '[' -r /usr/share/doc/cygwin-doc/html/cygwin-api/index.html ']'
+ /usr/bin/mkshortcut -P -n 'Cygwin (32-bit)/API (HTML)' -d 'Cygwin API Reference HTML' -- /usr/share/doc/cygwin-doc/html/cygwin-api/index.html
+ read target name desc

# create Home Page and FAQ URL link shortcuts
while read target name desc
do
	$mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -a $target -- $launch
done <<EOF
$site/index.html	Home\ Page	Cygwin\ Home\ Page\ Link
$site/faq.html		FAQ	Cygwin\ Frequently\ Asked\ Questions\ Link
EOF
+ read target name desc
+ /usr/bin/mkshortcut -P -n 'Cygwin (32-bit)/Home Page' -d 'Cygwin Home Page Link' -a https://cygwin.com/index.html -- /usr/bin/cygstart
+ read target name desc
+ /usr/bin/mkshortcut -P -n 'Cygwin (32-bit)/FAQ' -d 'Cygwin Frequently Asked Questions Link' -a https://cygwin.com/faq.html -- /usr/bin/cygstart
+ read target name desc

[-- Attachment #3: setup.log.full.zip --]
[-- Type: application/x-zip-compressed, Size: 46832 bytes --]

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

* Re: cygwin-doc post install script failures
  2020-12-15 20:51   ` Marco Atzeri
@ 2020-12-16 22:53     ` Brian Inglis
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Inglis @ 2020-12-16 22:53 UTC (permalink / raw)
  To: cygwin

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

On 2020-12-15 13:51, Marco Atzeri via Cygwin wrote:
> On 15.12.2020 21:03, Brian Inglis wrote:
>> On 2020-12-15 01:43, Marco Atzeri via Cygwin wrote:
>>> Not a recent bug but annoying anyway
>>>
>>> It seems the post-install script is not considering that the
>>> installation can be in a disk different from C: , properly
>>> in this case D:
>>
>> The post-install script does not care as mkshortcut uses POSIX paths.
>> Could you please check your paths with:
>>
>>      $ which -a mkshortcut
>>      /usr/bin/mkshortcut
> 
> all same
> 
>>
>>> 2020/12/15 08:40:13 running: d:\cygwin32\bin\bash.exe --norc --noprofile 
>>> "/etc/postinstall/cygwin-doc.sh"
>>> mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
>>> Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (PDF).lnk" failed; does 
>>> the target directory exist?
>>> mkshortcut: Saving "/cygdrive/c/ProgramData/Microsoft/Windows/Start 
>>> Menu/Programs/D:/cygwin32/Cygwin (32-bit)/User Guide (HTML).lnk" failed; does 
>>> the target directory exist?
>>
>> Please try:
>>
>>      $ sh --version
>>      GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)
>>      ...
>>
>> Could you please try rerunning the p-i script under sh -vx and post the 
>> output, as I can not see any way to rearrange the inputs and outputs to get 
>> that result, unless read or mkshortcut are damaged!
>>
>>> $ ls "/cygdrive/c/ProgramData/Microsoft/Windows/Start Menu/Programs/" | grep 
>>> Cygwin
>>> Cygwin
>>> Cygwin (32-bit)
>>
>> $ ll "$(cygpath -A -P -U)"/Cygwin*
>>
> 
> It works, but it is different from running under setup, as it is using
> 
> /proc/cygdrive/c/Users/Marco/AppData/Roaming/Microsoft/Windows/Start 
> Menu/Programs/Cygwin (32-bit)/

Thanks Marco,

Looks like problem may be memory allocation in mkshortcut.c(xstrndup), so have 
attached patches to apply to that source (from cygport? or amnually), and to p-i 
script to get strace.

So could you please apply the attached patch to /etc/postinstall/cygwin-doc.sh, 
and retry your manual p-i script rerun prefixed with CYGWINFORALL=-A 
/etc/postinstall/cygwin-doc.sh (may need elevated admin rights), and save that 
strace output; then retry your cygwin-doc setup, and save that strace output; 
then apply the attached mkshortcut.c patch, rebuild mkshortcut, retry your 
cygwin-doc setup, and save that strace output.

Hopefully the last try will no longer fail, otherwise I will have to set up my 
environment to reproduce the error.

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

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

[-- Attachment #2: etc.postinstall.cygwin-doc.patch --]
[-- Type: text/plain, Size: 698 bytes --]

--- a/etc/postinstall/cygwin-doc.sh	2020-07-07 04:30:32.868445900 -0600
+++ b/etc/postinstall/cygwin-doc.sh	2020-12-16 15:38:03.318870800 -0700
@@ -53,7 +53,8 @@ fi
 # create User Guide and API PDF and HTML shortcuts
 while read target name desc
 do
-	[ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -- $target
+	[ -w /tmp/mkshortcut.strace ] && trace='' || trace='/bin/strace -o /tmp/mkshortcut.strace'
+	[ -r "$target" ] && $trace $mks $CYGWINFORALL -P -n "Cygwin${wow64}/$name" -d "$desc" -- $target
 done <<EOF
 $doc/cygwin-ug-net.pdf		User\ Guide\ \(PDF\)  Cygwin\ User\ Guide\ PDF
 $html/cygwin-ug-net/index.html	User\ Guide\ \(HTML\) Cygwin\ User\ Guide\ HTML

[-- Attachment #3: mkshortcut.patch --]
[-- Type: text/plain, Size: 711 bytes --]

diff --git a/src/mkshortcut/mkshortcut.c b/src/mkshortcut/mkshortcut.c
index 6707eb43e3d0..f4ea1cc38b7b 100644
--- origsrc/mkshortcut/mkshortcut.c
+++ src/mkshortcut/mkshortcut.c
@@ -382,7 +382,7 @@ exit:
 static char *
 xstrndup (const char *string, size_t n)
 {
-  char *s = strndup (string, n);
+  char *s = strndup (string, n + 1);
   if (!s)
   {
     fprintf (stderr, "%s: out of memory\n", program_name);
@@ -395,7 +395,7 @@ static char *
 xstrncat (char **dest, const char *add, size_t n)
 {
   size_t len = strlen (*dest) + n + 1;
-  char *s = (char *) realloc (*dest, len * sizeof (char));
+  char *s = realloc (*dest, len);
   if (!s)
   {
     fprintf (stderr, "%s: out of memory\n", program_name);

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

end of thread, other threads:[~2020-12-16 22:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  8:43 cygwin-doc post install script failures Marco Atzeri
2020-12-15 20:03 ` Brian Inglis
2020-12-15 20:51   ` Marco Atzeri
2020-12-16 22:53     ` 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).