On 2025-09-16 18:11, Jakob Bohm via Cygwin wrote:
On 9/16/2025 8:49 PM, Brian Inglis via Cygwin wrote:
On 2025-09-16 03:20, Jakob Bohm via Cygwin wrote:
I was looking into trying out some local modifications to a cygwin
packaged program.  Thus I installed the sources via setup.exe then
copied /usr/src/* to a working directory and tried to rebuild the
package with the cygport all command.  But Even with different
packages and unchanged sources, cygport keeps failing with an error
that the first patch in the source will not apply.

What should I do to get to a buildable state?

Steps to reproduce (using bash as a simpler test example):
Note that above line clarifies that bash was just used as a test example
to show it was an issue in cygport, not the specific packageI am trying
to build.  Equivalently, any changes specific to the bash package are
irrelevant, including your comments about redhat URL specifics.

$ cd
$ mkdir cygsrc
$ cd cygsrc
$ cp -par /usr/src/* .
$ cd bash-5.2.21-1.src
$ cygport bash.cygport all
$ cygport --version

Results:

*** Info: Trying to enable case sensitivity on /home/me/cygsrc/ bash-5.2.21-1.src/bash-5.2.21-1.x86_64
 >>> Preparing bash-5.2.21-1.x86_64
 >>> Unpacking source bash-5.2.21.tar.gz
*** ERROR: patch bash-2.03-profile.patch will not apply

cygport 0.37.2
Copyright (C) 2020 Cygport authors
.

Without knowing the actual source package, version, and patch, it is hard to help. It is also easier to diagnose if we can see a verbatim transcript of commands run and output shown.
But here is a transcript of trying the undocumented (not in man cygport) --debug option (with username substituted by "me")

It is in `man cygport` for me:

$ man cygport | grep debug
       --debug
              enable debugging messages

Try `cygport --help` for better info: we should probably use `help2man` to update man pages, if there are mismatches.

$ cygport --debug bash.cygport all
+ shift
+ true
+ case ${1} in
+ break
+ argv=('/usr/bin/cygport' 'bash.cygport' 'all')
+ declare -ar argv
+ declare -ir argc=3
+ defined 'argv[1]'
+ ((  1 != 1  ))
+ '[' -n bash.cygport ']'
+ return 0
+ defined 'argv[2]'
+ ((  1 != 1  ))
+ '[' -n all ']'
+ return 0
+ source /usr/share/cygport/lib/check_funcs.cygpart
+ echo -e '\e[1;39m>>> Preparing bash-5.2.21-1.x86_64\e[0;0m'
 >>> Preparing bash-5.2.21-1.x86_64

/home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21.tar.gz ']'

+ '[' -f /home/me/cygsrc/bash-5.2.21-1.src/bash-2.03-profile.patch -a '!' -f bash-2.03-profile.patch ']'

+ cd /home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21-1.x86_64/origsrc

+ unpack_cmd='tar xf'
+ __step 'Unpacking source bash-5.2.21.tar.gz'
+ echo -e '>>> Unpacking source bash-5.2.21.tar.gz'
 >>> Unpacking source bash-5.2.21.tar.gz

+ tar xf /home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21.tar.gz
+ '[' '!' -d /home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21-1.x86_64/origsrc/ bash-5.2.21 ']' + chmod +x /home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21-1.x86_64/origsrc/ bash-5.2.21
+ cd /home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21-1.x86_64/origsrc/bash-5.2.21

+ cygpatch /home/me/cygsrc/bash-5.2.21-1.src/bash-2.03-profile.patch

+ patch -N -s --dry-run -p1 -i /home/me/cygsrc/bash-5.2.21-1.src/bash-2.03- profile.patch

+ error 'patch bash-2.03-profile.patch will not apply'
+ case $? in
+ local errorcode=1
+ echo -e '\e[1;31m*** ERROR:\e[0;0m patch bash-2.03-profile.patch will not 
apply'
*** ERROR: patch bash-2.03-profile.patch will not apply
+ exit 1

me@MACHINE ~/cygsrc/bash-5.2.21-1.src

Try running:

$ cd /home/me/cygsrc/bash-5.2.21-1.src/bash-5.2.21-1.x86_64/origsrc/bash-5.2.21
$ patch --verbose -N -s --dry-run -p1 -i /home/me/cygsrc/bash-5.2.21-1.src/bash-2.03-profile.patch

You are expected to run cygport from within the directory where the package sources including the <PACKAGE>.cygport were downloaded or installed (often / usr/src/<PACKAGE>).

Not sure how the statements below applies to an already populated complete src directory for the test package (which happens to be bash).

By default, if you use download/fetch/wget/get/...all cygport will re-download any sources or patches which are not local or in its upstream cache defined as ${DISTDIR:-$HOME/Downloads}, and they may have changed. Also incorrect versions of unlabelled/unversioned sources or patches may be found in its upstream cache and used.

If anything is not found locally, and what that means may vary by source, it will be checked for in the upstream source cache ${DISTDIR:-$HOME/Downloads}, and what is available locally or in the upstream source cache may not be the same file used in the original build!

I have no idea where your sources originated without seeing the whole transcript, including downloadall or equivalent, but wcurl/tar/prep works for me:

$ wcurl https://mirror.cpsc.ucalgary.ca/mirror/cygwin.com/x86_64/release/bash/bash-5.2.21-1-src.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10.4M  100 10.4M    0     0  19.8M      0 --:--:-- --:--:-- --:--:-- 19.9M
$ tar -xf bash-5.2.21-1-src.tar.xz
$ cd bash-5.2.21-1.src
$ cygport --version
cygport 0.37.2
Copyright (C) 2020 Cygport authors      # -> needs updated!
...
$ cygport bash.cygport prep
*** Info: Trying to enable case sensitivity on /usr/src/bash/bash-5.2.21-1.src/bash-5.2.21-1.x86_64
>>> Preparing bash-5.2.21-1.x86_64
>>> Unpacking source bash-5.2.21.tar.gz
*** Info: applying patch bash-2.03-profile.patch (-p1):
patching file config-top.h
Hunk #1 succeeded at 23 (offset -3 lines).
*** Info: applying patch bash-2.05a-interpreter.patch (-p1):
...
>>> Preparing working source directory
*** Info: applying patch bash-5.2.21-1.src.patch (-p2):
patching file doc/man.pages
patching file support/bashbug.sh

I also built a bunch of updated packages from sources last weekend with no issues, and got nearly identical results on our CI system, from which the updated packages were deployed to the mirrors.

Perhaps check no other instances of required utilities are prior to Cygwin's on your PATH:

$ which -a bzip2 cat chmod cp date diff diffstat dos2unix file find gawk grep gzip install ln mkdir mv patch rm rsync sed sort tar touch which xargs xz
alias chmod='/bin/chmod -c'
        /bin/chmod
alias cp='/bin/cp -iv'
        /bin/cp
alias diff='diff -pu --color --strip-trailing-cr'
        /usr/bin/diff
alias grep='/bin/grep --color=auto'
        /bin/grep
alias ln='/bin/ln -iv'
        /bin/ln
alias mv='/bin/mv -iv'
        /bin/mv
alias rm='/bin/rm -iv'
        /bin/rm
alias tar='/bin/tar -a'
        /bin/tar
alias touch='/bin/touch -ch'
        /bin/touch
/usr/bin/bzip2
/usr/bin/cat
/usr/bin/chmod
/usr/bin/cp
/usr/bin/date
/usr/bin/diffstat
/usr/bin/dos2unix
/usr/bin/file
/usr/bin/find
/proc/cygdrive/c/WINDOWS/system32/find
/usr/bin/gawk
/usr/bin/grep
/usr/bin/gzip
/usr/bin/install
/usr/bin/ln
/usr/bin/mkdir
/usr/bin/mv
/usr/bin/patch
/usr/bin/rm
/usr/bin/rsync
/usr/bin/sed
/usr/bin/sort
/proc/cygdrive/c/WINDOWS/system32/sort
/usr/bin/tar
/proc/cygdrive/c/WINDOWS/system32/tar
/usr/bin/touch
which ()
{
    ( alias;
declare -f ) | command which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" 2> /dev/null
}
/usr/bin/which
/usr/bin/xargs
/usr/bin/xz

and mounts look normal:

$ mount
C:/.../cygwin64/bin on /usr/bin type ntfs (binary,auto)
C:/.../cygwin64/lib on /usr/lib type ntfs (binary,auto)
C:/.../cygwin64 on / type ntfs (binary,auto)
C: on /proc/cygdrive/c type ntfs (binary,posix=0,noumount,auto)
D: on /proc/cygdrive/d type ntfs (binary,posix=0,noumount,auto)
F: on /proc/cygdrive/f type unknown (binary,posix=0,noumount,auto)
G: on /proc/cygdrive/g type unknown (binary,posix=0,noumount,auto)

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

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                -- Antoine de Saint-Exupéry

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to