DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 58HBmvKo1289439 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 58HBmvKo1289439 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=Leqptd6k X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D1B4385843D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1758109735; bh=8Q6v+xNZ8qTFVTLV6QW7AYMP6nU3FB094a2jwDwG+3c=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Leqptd6kcjtSPb9tOKzfp5EfYtceI0fdDaFXX6Dvis8ivxVw22fTduwF0obdcb3H5 jWeZOydc+1o6eg/9B3+0XLc5+gnH54LymNHk6bLv7kzSJ93IcVSRtD6Z4zPfaZIfl6 UJCZQp4qTEoFV+M4O9sYCIVzlJY6KgnFSgyIDtU4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 946D53858C60 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 946D53858C60 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758109704; cv=none; b=wSgsEZkS6wymq6IvI5OOSXw7Y/yJDI9VinX0p651/KFFgXqZRN/UKbpgAsiPjddkpRj6ixqjg02uZxbZ6K4ss9wpZ5Rza3jmBzu5xs0nIDZENrnxCjUq8k1tMga+a2hTdLa36DF5u6RLTjUELs777GwcPndDv7DDlRPb6sLvGXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758109704; c=relaxed/simple; bh=mvYvEmEV/W4OnAWajMFCBetUFXgAcnOCfzQEOwuQGy8=; h=DKIM-Signature:Subject:To:From:Message-ID:Date:MIME-Version; b=SZcN7g15QZS5ociuB6oKSigLdo1eT7BrNLoAhWOpZ5dPeEAp58oICigDdDgOeBEHOVmQmNGn4EsNt7k8e+gFovRR55nqyMD2aKi40exgNDht8lEPOMI5Xuh1e0yaFXzwAylBKa5QQGLV1bdjWPH5jupcaJHLeAxBqhiSIhONs1s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 946D53858C60 Subject: Re: cygport 0.37.2 keeps failing with patch will not apply To: cygwin AT cygwin DOT com References: <87a19a0c-c668-b195-e28e-d4dd7a069b9d AT wisemo DOT com> <95215312-b19a-44bb-a769-6e1faa591821 AT SystematicSW DOT ab DOT ca> <476a235a-db54-4a0f-8917-d283a6df28c2 AT SystematicSW DOT ab DOT ca> Organization: WiseMo A/S Message-ID: <76025dd8-49f1-cc95-8fa4-1d054c7ab5aa@wisemo.com> Date: Wed, 17 Sep 2025 13:48:24 +0200 X-Mailer: Epyrus/2.1.3 MIME-Version: 1.0 In-Reply-To: <476a235a-db54-4a0f-8917-d283a6df28c2@SystematicSW.ab.ca> Content-Language: en-US X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jakob Bohm via Cygwin Reply-To: Jakob Bohm Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 58HBmvKo1289439 Hi List, Solution further down! On 9/17/2025 3:49 AM, Brian Inglis via Cygwin wrote: > 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. Reemphasizing this, as I kept getting replies highly specific to bash, when bash was just a random choice from the setup.exe menus. >>>> >>>> $ 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 > OK, admitted, it was on the manpage, I just overlooked it.  Also the debug output seems to be both too verbose and too incomplete for anyone but the cygport author to understand. > 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 AT 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 Again, a suggestion specific to bash, but I can try. And patch --verbose gave a meaningful error message suppressed by cygport, even in debug mode: the CYGWIN tmp dir was still mounted to the cygwin64\tmp default location, thus writable only by admins/wheel, not developers or other non-wheel users. Fix was to add this comment and line to /etc/fstab as root, then restarting all processes that access cygwin1.dll shared memory.  These lines really should be the sane default. ###### Solution!!!!!! # Map Windows per user temp dir to CYGWIN /tmp dir none    /tmp    usertemp binary,posix=1,noacl,dos,user   0       0 (noacl needed because the cygwin core code uses a broken old algorithm that adds NTACL entries for user NONE and generally causes ACL corruption) . > >>> You are expected to run cygport from within the directory where the >>> package sources including the .cygport were downloaded or >>> installed (often / usr/src/). >> >> 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: As I wrote repeatedly, these are the sources installed by setup.exe when checking the "src" box for a package, nothing exotic or manual. > > $ 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: PATH in cygwin console has /usr/local/bin and /usr/bin as first elements, so that was not the issue.  Issue is that cygport does a bunch of unrelated things before invoking patch in a way that requires write access to /tmp which failsdue to cygwin defaulting to a root-owned /tmp . Then cygport further adds to the confusion by claiming that it is an issue withpatching, not /tmp/ access. > (snip long example of using which to check PATH of lots of tools) And mounts were subtly wrong (/tmp implicitly included in the root mount to a root-owned software dir) Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. https://www.wisemo.com Transformervej 29, 2860 Søborg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded -- 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