**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.bajr...@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.bajr...@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/3...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to