public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Zhibin Dong <developerdong@gmail.com>
To: isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH] image: check if the file is core dump
Date: Tue, 16 Apr 2024 19:11:04 -0700 (PDT)	[thread overview]
Message-ID: <99c50a12-bcb3-4d45-83b1-18988deb35bbn@googlegroups.com> (raw)
In-Reply-To: <18fa0d57df55365ef4aeb0391593a213483a2197.camel@siemens.com>


[-- Attachment #1.1: Type: text/plain, Size: 2603 bytes --]

 

> Are we sure this works in cross-arch scenarios? I.e. can an amd64 "file" 
detect arm64 coredumps? Did you test this Zhibin Dong?
> If so, this patch is fine. 

On an amd64 platform, I execute these commands.
$ file ./core.amd64
./core.amd64: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), 
SVR4-style, from './crashing_program', real uid: 1000, effective uid: 1000, 
real gid: 1000, effective gid: 1000, execfn: './crashing_program', 
platform: 'x86_64'
$ file ./core.aarch64
./core.aarch64: ELF 64-bit LSB core file, ARM aarch64, version 1 (SYSV), 
SVR4-style, from './crashing_program_aarch64', real uid: 1000, effective 
uid: 1000, real gid: 1001, effective gid: 1001, execfn: 
'./crashing_program_aarch64', platform: 'aarch64'

`file` can determine the architecture of a file and also determine if it is 
a core file.
在2024年4月17日星期三 UTC+8 05:02:35<MOESSBAUER, Felix> 写道:

> On Tue, 2024-04-16 at 13:12 +0800, Zhibin Dong wrote:
> > The previous code does a wrong judgement in two cases:
> > 1. a file is suffixed by .core but is not a core dump file
> > 2. a file is a core dump file but is not suffixed by .core
>
> Hi, just for reference: This is an addition to the pattern implemented
> in https://groups.google.com/g/isar-users/c/JtCExK7m4OY/m/F9QaxKBSAQAJ
>
> > 
> > The new code uses `file` to determine the type of files, which is
> > more
> > accurate.
> > 
> > Signed-off-by: Zhibin Dong <zhibi...@siemens.com>
> > ---
> >  meta/classes/image.bbclass | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> > index 98741da0..10923947 100644
> > --- a/meta/classes/image.bbclass
> > +++ b/meta/classes/image.bbclass
> > @@ -444,7 +444,7 @@ EOSUDO
> >  
> >      # Sometimes qemu-user-static generates coredumps in chroot, move
> > them
> >      # to work temporary directory and inform user about it.
> > -    for f in $(sudo find ${ROOTFSDIR} -type f -name *.core); do
> > +    for f in $(sudo find ${ROOTFSDIR} -type f -exec file {} \; |
>
> Are we sure this works in cross-arch scenarios? I.e. can an amd64
> "file" detect arm64 coredumps? Did you test this Zhibin Dong?
> If so, this patch is fine.
>
> Best regards,
> Felix
>
> > grep 'core file' | cut -d: -f1); do
> >          sudo mv "${f}" "${WORKDIR}/temp/"
> >          bbwarn "found core dump in rootfs, check it in
> > ${WORKDIR}/temp/${f##*/}"
> >      done
> > -- 
> > 2.39.2
> > 
>
> -- 
> Siemens AG, Technology
> Linux Expert Center
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4045 bytes --]

  reply	other threads:[~2024-04-17  2:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AQHaj8I6385ePySTC0KmWAQOaNXsHbFrY0SA>
2024-04-16  5:12 ` Zhibin Dong
2024-04-16 21:02   ` MOESSBAUER, Felix
2024-04-17  2:11     ` Zhibin Dong [this message]
2024-04-17  4:57   ` Schmidt, Adriaan
2024-04-17  6:46   ` Zhibin Dong
2024-04-17  6:50     ` Zhibin Dong
2024-06-17  5:23       ` Uladzimir Bely
2024-06-27 15:44     ` Jan Kiszka
2024-07-01  4:56       ` Schmidt, Adriaan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99c50a12-bcb3-4d45-83b1-18988deb35bbn@googlegroups.com \
    --to=developerdong@gmail.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox