Re: [Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-08-17 Thread Florian Festi
OK, it looks like this is going to get fixed in the kernel. Closing this here. 
In case the kernel fix won't make feel free to re-open the discussion.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682#issuecomment-900137623___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-08-17 Thread Florian Festi
Closed #1682.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682#event-5167721940___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-05-28 Thread skysley
I can reproduce the problem with fscrypt on my ext4 /home partition:
```
$ mount | grep "/boot"
/dev/sda1 on /boot type ext4 (rw,relatime,data=ordered)
```

Steps to reproduce:

[Step A]
Make sure fscrypt is installed and set up.

[Step B]
Create base test directory:
```
cd ~ 
mkdir test_rpm
cd test_rpm
```

[Step C]
Create a non-encrypted directory to check that rpmbuild works normally:
```
mkdir no_encryption
cd no_encryption
```

[Step D]
Download spec file from here and build:
```
wget https://github.com/rpm-software-management/rpm/files/6457257/hello.spec.txt
mv hello.spec{.txt,}
rpmbuild -bb --define 'input_dir input' --buildroot ${PWD}/build hello.spec
```
[Step E]
Observe that the rpm has been built successfully.

[Step F]
Create an encrypted directory:
```
cd ~/test_rpm
mkdir fscrypt
```
```
fscrypt encrypt fscrypt

Should we create a new protector? [y/N] y
Enter the source number for the new protector [2 - custom_passphrase]: 2
Enter a name for the new protector: rpm_test_protector
Enter custom passphrase for protector "rpm_test_protector": 123456 (<-- 
invisible)
Confirm passphrase: 123456 (<-- invisible)
"fscrypt" is now encrypted, unlocked, and ready for use.
```
```
cd fscrypt
```
[Step G]
Perform step D again.

[Step H]
Observe that the build has failed.

output of rpmbuild:
```
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.mhWm7Y
+ umask 022
+ cd /home/dns/rpmbuild/BUILD
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.a6AYr1
+ umask 022
+ cd /home/dns/rpmbuild/BUILD
+ mkdir -p /home/dns/test_rpm/fscrypt/build
+ mkdir -p input/opt
+ cat
+ g++ /home/dns/test_rpm/fscrypt/build/someprog.cpp -o input/opt/someprog
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Ev5cH9
+ umask 022
+ cd /home/dns/rpmbuild/BUILD
+ /usr/bin/rm -rf /home/dns/test_rpm/fscrypt/build
+ /usr/bin/mkdir -p /home/dns/test_rpm/fscrypt
+ /usr/bin/mkdir /home/dns/test_rpm/fscrypt/build
+ cp -r input/opt /home/dns/test_rpm/fscrypt/build
+ '[' '%{buildarch}' = noarch ']'
+ QA_CHECK_RPATHS=1
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/brp-compress /usr
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
Processing files: hello-world-1-1.x86_64
Provides: hello-world = 1-1 hello-world(x86-64) = 1-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 
4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files 
/home/dns/test_rpm/fscrypt/build
error: create archive failed: cpio: write failed - No such file or directory


RPM build errors:
create archive failed: cpio: write failed - No such file or directory
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682#issuecomment-850412352___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-05-25 Thread skysley
As I said, it might have something to do with the encrypted file systems I use 
(luks and fscrypt). Maybe I can take the time this week to test this a bit more.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682#issuecomment-847822867___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-05-25 Thread Panu Matilainen
> If you are lucky, observe error on some locations

It'd be helpful to mention some example(s) of such locations.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682#issuecomment-847818869___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-05-14 Thread skysley
My guess is that it is wrongly assumed that the size of a symbolic link equals 
the length of the path that the symbolic link points to.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682#issuecomment-841154633___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [rpm-software-management/rpm] rpmbuild fails with symbolic links (#1682)

2021-05-11 Thread skysley
I Initially submitted this bug at 
[bugzilla.redhat.com](https://bugzilla.redhat.com/show_bug.cgi?id=1953372).

**Description of problem:**
On my Arch Linux (5.10.16-arch1-1) I cannot build a simple spec file (see 
attachment at the bottom) depending the directory from which the package is 
being built.

**Version-Release number of selected component (if applicable):**
* 4.16.1.2 (from Arch Linux rpm-tools)
* rpm-4.16.0-alpha-417-ge1fbd486e (git: 
e1fbd486e9bdd52fa7c5b5efea4ce9de13e48955)

**How reproducible:**
Not sure. May depend on filesystem.

**Steps to Reproduce:**
1. Copy spec file to different locations on system

2. On each location, build the attached spec file using this command:
`rpmbuild -bb --define 'input_dir input' --buildroot ${PWD}/build `


**Actual results:**
If you are lucky, observe error on some locations:
```
error: create archive failed: cpio: write failed - No such file or directory


RPM build errors:
create archive failed: cpio: write failed - No such file or directory
```


**Expected results:**
Having a working .rpm package.


**Additional info:**

I debugged through the git version shown above. Please note that I am not very 
confident with all of the internals.

The attached spec file compiles a simple C++ program and adds this to the build 
root. For reasons I don't know rpmbuild creates a symbolic link to this 
program. Depending on the directory I build the rpm in, the symbolic link has a 
file size of either 24 Bytes or 34 Bytes. Notice: 24 is also the length of the 
path that the symbolic link points to.

In files.c (function `addFile`) the file size is read using `lstat`. In cpio.c 
the expected file end is computed as 

`cpio->fileend = cpio->offset + st->st_size;`

In rpmfi.c (function `iterWriteArchiveNext`) the length of the path is taken 
that the symbolic link points to. This string is written into the archive and 
`offset` is incremented by the length of the path. 

Since the path length is not necessarily equal to the size of the symbolic link 
the rpmbuild may fail at the end when `fileend` is checked to be equal to 
`offset`.

What I haven't looked into is whether this has something to do with encrypted 
file systems. I am using luks and fscrypt.

.spec file: 
[hello.spec.txt](https://github.com/rpm-software-management/rpm/files/6457257/hello.spec.txt)



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1682___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint