Bug 14080 - string replace in do_install_append breaks pseudo
Summary: string replace in do_install_append breaks pseudo
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ major
Target Milestone: 3.2 M4
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2020-10-08 05:48 UTC by nickersk
Modified: 2020-10-09 04:05 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Patch to pseudo which fixed the issue on my system (3.70 KB, patch)
2020-10-08 15:35 UTC, Richard Purdie
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nickersk 2020-10-08 05:48:33 UTC
we have in do_install_append in initscripts bbappend this replace commands:

perl -i -pe 's:mount -a.+?$:mount -a -t 
 nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2,ceph -O no_netdev 2>/dev/null:' ${D}${sysconfdir}/init.d/mountall.sh

perl -i -pe 's:(mount -a).*?$:$1:' ${D}${sysconfdir}/init.d/mountnfs.sh

which causes pseudo abort and build fail.

this error became in place after this oe-core commit: 
https://git.openembedded.org/openembedded-core/commit/?h=master-next&id=2db491d97da08d44ebd257f98489550a82a7935c

how can/should be this error fixed?
Comment 1 Randy MacLeod 2020-10-08 07:52:43 UTC
CAan you clean the recipe and report if this is reproducible?

If it is, please also, try to remove your <proj>/tmp directory?
Richard is going to add a warning if this clean-up is needed.
Comment 2 nickersk 2020-10-08 08:36:03 UTC
wipeing out tmpdir, do_cleanall and build from scratch didnt work, same error

exit 134 from 'perl -i
-pe 's:mount -a.+?$:mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,g
fs2,ceph -O no_netdev 2>/dev/null:'
tmp/work/mips32el-oe-linux/initscripts/1.0-r155.7/image/etc/init.d/mountall.sh'
Comment 3 Joshua Watt 2020-10-08 08:38:32 UTC
I ran perl under strace to see if it's doing something weird. Here is the relevant output:

$ touch foo.txt; strace perl -i -pe 's:(mount -a).*?$:$1:' foo.txt
openat(AT_FDCWD, "foo.txt", O_RDONLY)   = 3                                     
ioctl(3, TCGETS, 0x7fffde1209f0)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0                                     
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0                            
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0                                     
unlink("foo.txt")                       = 0                                     
openat(AT_FDCWD, "foo.txt", O_WRONLY|O_CREAT|O_EXCL, 0600) = 4                   
ioctl(4, TCGETS, 0x7fffde1209f0)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR)                   = 0                                      
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0                             
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0                                      
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0                             
fchmod(4, 0100644)                      = 0                                      
read(3, "", 8192)                       = 0                                      
close(4)                                = 0                                      
close(3)                                = 0
Comment 4 Richard Purdie 2020-10-08 14:28:59 UTC
I think Joshua ran that under perl 5.26.1 and I saw similar on my build machine where that do_install_append worked. I did find a machine with perl 5.30 on it which gave:

openat(AT_FDCWD, "foo.txt", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, TCGETS, 0x7ffe3b6def30)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
umask(0177)                             = 002
getpid()                                = 3242451
openat(AT_FDCWD, "XXCPEqW8", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4
fcntl(4, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
umask(002)                              = 0177
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
ioctl(4, TCGETS, 0x7ffe3b6defc0)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(4, 0, SEEK_CUR)                   = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
getpid()                                = 3242451
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
fstat(5, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=978944, ...}) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
fchmod(4, 0100664)                      = 0
brk(0x55aebdfc7000)                     = 0x55aebdfc7000
read(3, "", 8192)                       = 0
close(4)                                = 0
getpid()                                = 3242451
renameat(5, "XXCPEqW8", 5, "foo.txt")   = 0
close(5)                                = 0
close(3)                                = 0

Which perl version is on the system from the original report?
Comment 5 Richard Purdie 2020-10-08 14:59:56 UTC
I confirmed this is only an issue with perl 5.30 and does abort on that system. It looks like the:

openat(AT_FDCWD, "XXCPEqW8", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4

call isn't seen by pseudo. Running out of time to work out why today though.
Comment 6 Richard Purdie 2020-10-08 15:35:50 UTC
Created attachment 4737 [details]
Patch to pseudo which fixed the issue on my system
Comment 7 Richard Purdie 2020-10-08 15:36:58 UTC
When I applied the attached patch to pseudo, this started working for me on my system with perl 5.30. Could you confirm if it works for you please?
Comment 8 nickersk 2020-10-08 22:36:49 UTC
I can confirm, works with provided patch. Thank You.
Comment 9 Richard Purdie 2020-10-09 04:05:04 UTC
Thanks for testing.

I've merged the fix into pseudo and master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d446d8b818a49e66b72fccbd29328cdbf4294239