[Rpm-maint] [rpm-software-management/rpm] posttrans $1 equals 1 which should be 2 according the documents (Issue #3033)
ClarkZhaoHF
notifications at github.com
Fri Apr 12 01:19:49 UTC 2024
**Describe the bug**
In posttrans script, the $1 should be 2 according to the document here:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#:~:text=The%20%25posttrans%20runs%20a%20script%20that%20checks%20if,script%20only%20performs%20its%20action%20once%20per%20transaction.
but we find that $1 is actually 1.
**To Reproduce**
1. Prepare a rpm package and a newer version.
2. install the old one: dnf install hello-0.0.1-1.el8.noarch.rpm
3. install the new one: dnf install hello-0.0.2-1.el8.noarch.rpm
```
Name: hello
Version: 0.0.1
Release: 1%{?dist}
Summary: A simple hello world script
BuildArch: noarch
License: GPL
Source0: %{name}-%{version}.tar.gz
Requires: bash
%description
A demo RPM build
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cp %{name}.sh $RPM_BUILD_ROOT/%{_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{_bindir}/%{name}.sh
%changelog
* Sun Nov 18 2020 Valentin Bajrami <valentin.bajrami at slimmer.ai> - 0.0.1
- First version being packaged
```
```
Name: hello
Version: 0.0.2
Release: 1%{?dist}
Summary: A simple hello world script
BuildArch: noarch
License: GPL
Source0: %{name}-%{version}.tar.gz
Requires: bash
%description
A demo RPM build
%prep
%setup -q
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
cp %{name}.sh $RPM_BUILD_ROOT/%{_bindir}
%posttrans
echo "%posttrans"
echo $1
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{_bindir}/%{name}.sh
%changelog
* Sun Nov 18 2020 Valentin Bajrami <valentin.bajrami at slimmer.ai> - 0.0.1
- First version being packaged
```
**Expected behavior**
$1 should be 2 in the posttrans script
**Output**
%posttrans
1
**Environment**
CentOS Linux release 8.4.2105
**Additional context**
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3033
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/issues/3033 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240411/b7fe3bc2/attachment-0001.html>
More information about the Rpm-maint
mailing list