DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 58GIoagL538619
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 58GIoagL538619
X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F8203857348
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F8203857348
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1758048602; cv=none;
 b=kTx/KFzw9qYekSPFXNquz982c5GF6nUqmPZRM5nrh8Zv94eB/ReXrapLUiAW6RSlyedxsIbAqUAU7x1hY28Eqp3uc79f9JYNVitvB6S8xWjgN+KxwNBB6bkfm6Wvy5BF5TKFRTdOOuui9nK+LEdgwqvMbl62pfm2T5agWTQHoQU=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1758048602; c=relaxed/simple;
 bh=A7EjIBAFsg1q8qpQ99t4vsTaZuoDcSHkjXww1HF0qRo=;
 h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature;
 b=kv9WDHyEXEhywwFXhWyp+umvwOTmPm6pK4+Q6XQD5qsaDnnKlaF5YgxXnb7taadlSW6NKC+fpChYyvG6bJX+BRPgqKN333DhugyuJAFch3ONvP02jkihEdGiC+FIUYU/mGEZKpBVH9i6NumKaG7JhQLv1lm7+nuG8R6taOO3hN8=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <95215312-b19a-44bb-a769-6e1faa591821@SystematicSW.ab.ca>
Date: Tue, 16 Sep 2025 12:49:29 -0600
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: cygport 0.37.2 keeps failing with patch will not apply
To: cygwin@cygwin.com
References: <87a19a0c-c668-b195-e28e-d4dd7a069b9d@wisemo.com>
Content-Language: en-CA
Organization: Systematic Software
In-Reply-To: <87a19a0c-c668-b195-e28e-d4dd7a069b9d@wisemo.com>
X-Stat-Signature: aketsdyboj8tpaqkuyetyiy81bgknos6
X-Rspamd-Server: rspamout07
X-Rspamd-Queue-Id: 2FDFB20026
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX1+pBHUMFms53Tsm4+Lwssl0ae4QkAyZTD8=
X-HE-Tag: 1758048570-874514
X-HE-Meta: U2FsdGVkX1+n0YORAJVkfGQPyc7G9Jg1HVqpTvYSLiE/224N/j5QMwlJN6Z5s8fTSqflsI7UAtdT5tC33XdyDWT1L/0HIHbeymvHJnQdwkoco776StbUwKn4CmM/vgXSslM9JkOIruhJAyb8JMN+Fpo0S17ZY3eKjuAdP1mngUKIIgXjlSe7/srVKy7o7F4gIZvVk+7KQzZ6SlGOFjrhl6x2COmsFztrzovLavf4zwdUfpS7WrgZHSA5pUoO79F+Qo685o2tf2at8j/gYpOYjld6W48wDUK0WRJzO+rSDA4+8/y+sGk0Dlk46z1fsxvK/GoCrFjxkD+XLKy1bp/c6NxBZSONhKA5nIEu2Rr5RTuG6LWWGk2InxJeHwlBWmmFB9aKWZSy89PQoROod+r1WSnMX5z+boTgxHvdOwfKp2WWXYJd4/0sVA==
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 58GIoagL538619

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):
> 
> $ 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/jb.WISEMO/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
> 
> This program comes with NO WARRANTY, to the extent permitted by law.
> 
> You may redistribute copies of this program under the terms of
> the GNU General Public License as published by the Free Software
> Foundation, either version 3 of the License, or (at your option) any
> later version.
> 
> For more information about these matters, see the file named COPYING.
> 
> Written for the Cygwin project <https://cygwin.com/>.

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.

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

For example, in bash.cygport, it is not the best long term idea to refer to 
Fedora upstream patch source branches rawhide or main, as they always refer to 
recent sources and they may change:

https://src.fedoraproject.org/rpms/bash/raw/rawhide/f/bash-2.03-profile.patch

so better to refer to f43 (or the then current stable branch release) than 
rawhide or main.

It also appears that rawhide upstream sources are now bash 5.3 not 5.2.21, so 
some patches may have been changed to accommodate source changes.

Your best approach is probably to run cygport --debug ... prep:

$ cygport --debug <PACKAGE>.cygport prep |& tee <PACKAGE>-cygport-prep-debug.log

to see what it is doing and complaining about, then manually redo the last cd 
and patch commands before failure, adding the patch --verbose option to get more 
detailed diagnostic messages.

The commands you run should be similar to:

$ cd /home/jb.WISEMO/cygsrc/bash-5.2.21-1.src/bash-5.2.21-1.x86_64/src/bash-5.2.21/
$ patch --verbose -N -p1 --no-backup-if-mismatch -i .../bash-2.03-profile.patch

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

