From: Yue Hu <zbestahu@gmail.com>
To: Gao Xiang <hsiangkao@redhat.com>
Cc: xiang@kernel.org, linux-erofs@lists.ozlabs.org, huyue2@yulong.com
Subject: Re: [PATCH] AOSP: erofs-utils: fix sub directory prefix path in canned fs_config
Date: Tue, 22 Dec 2020 16:10:58 +0800 [thread overview]
Message-ID: <20201222160935.000061c3.zbestahu@gmail.com> (raw)
In-Reply-To: <20201222070458.GA1803221@xiangao.remote.csb>
On Tue, 22 Dec 2020 15:04:58 +0800
Gao Xiang <hsiangkao@redhat.com> wrote:
> Hi Yue,
>
> On Tue, Dec 22, 2020 at 02:31:12PM +0800, Gao Xiang wrote:
>
> ...
>
> >
> > Ok, I will try to find some clue to verify later.
> >
> > >
> > > >
> > > > > Moreover, we should not add the mount point to fspath on root inode for
> > > > > fs_config() branch.
> > > >
> > > > Is there some descriptive words or reference for this? To be honest,
> > > > I'm quite unsure about this kind of Android-specific things... :(
> > >
> > > Refer to change: mksquashfs: Run android_fs_config() on the root inode
> > >
> > > I think erofs of AOSP has this issue also. Am i right?
> >
> > Not quite sure if it effects non-canned fs_config after
> > reading the commit message...
> > https://android.googlesource.com/platform/external/squashfs-tools/+/85a6bc1e52bb911f195c5dc0890717913938c2d1%5E%21/#F0
> >
> > And no permission to access Bug 72745016, so...
> > maybe we need to limit this to non-canned fs_config only?
> > (at least confirming the original case would be better)
> >
> > BTW, Also, from its testcase command line in the commit message:
> > "mksquashfs path system.raw.img -fs-config-file fs_config -android-fs-config"
> >
> > I'm not sure if "--mount-point" is passed in so I think for
> > such case no need to use such "goto" as well?
> >
> > Thanks,
> > Gao Xiang
>
> Could you verify the following patch if possible? (without compilation,
> I don't have test environment now since AOSP code is on my PC)
>
> From: Yue Hu <huyue2@yulong.com>
> Date: Tue, 22 Dec 2020 14:52:22 +0800
> Subject: [PATCH] AOSP: erofs-utils: fix sub-directory prefix for canned
> fs_config
>
> "failed to find [%s] in canned fs_config" is observed by using
> "--fs-config-file" option under Android 10.
>
> Notice that canned fs_config has a prefix to sub-directory if
> "--mount-point" presents. However, such prefix cannot be added by
> just using erofs_fspath().
>
> Fixes: 8a9e8046f170 ("AOSP: erofs-utils: add fs_config support")
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> Signed-off-by: Gao Xiang <hsiangkao@aol.com>
> ---
> lib/inode.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/lib/inode.c b/lib/inode.c
> index 3d634fc..9469074 100644
> --- a/lib/inode.c
> +++ b/lib/inode.c
> @@ -701,21 +701,25 @@ int erofs_droid_inode_fsconfig(struct erofs_inode *inode,
> char *fspath;
>
> inode->capabilities = 0;
> + if (!cfg.mount_point)
> + fspath = erofs_fspath(path);
lib/inode.c:688:10: error: assigning to 'char *' from 'const char *' discards...
fspath = erofs_fspath(path);
^ ~~~~~~~~~~~~~~~~~~
- fspath = erofs_fspath(path);
+ fspath = (char *)erofs_fspath(path);
> + else if (asprintf(&fspath, "%s/%s", cfg.mount_point,
> + erofs_fspath(path)) <= 0)
The argument of path will be root directory. And canned fs_config for root directory as
below:
0 0 755 selabel=u:object_r:rootfs:s0 capabilities=0x0
So, cannot add mount point to root directory for canned fs_config. And what about non-canned
fs_config?
Thx.
> + return -ENOMEM;
> +
> +
> if (cfg.fs_config_file)
> - canned_fs_config(erofs_fspath(path),
> + canned_fs_config(fspath,
> S_ISDIR(st->st_mode),
> cfg.target_out_path,
> &uid, &gid, &mode, &inode->capabilities);
> - else if (cfg.mount_point) {
> - if (asprintf(&fspath, "%s/%s", cfg.mount_point,
> - erofs_fspath(path)) <= 0)
> - return -ENOMEM;
> -
> + else
> fs_config(fspath, S_ISDIR(st->st_mode),
> cfg.target_out_path,
> &uid, &gid, &mode, &inode->capabilities);
> +
> + if (cfg.mount_point)
> free(fspath);
> - }
> st->st_uid = uid;
> st->st_gid = gid;
> st->st_mode = mode | stat_file_type_mask;
next prev parent reply other threads:[~2020-12-22 8:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-22 2:04 [PATCH] AOSP: erofs-utils: fix sub directory prefix path in canned fs_config Yue Hu
2020-12-22 3:44 ` Gao Xiang
2020-12-22 4:47 ` Yue Hu
2020-12-22 6:31 ` Gao Xiang
2020-12-22 7:04 ` Gao Xiang
2020-12-22 7:12 ` Yue Hu
2020-12-22 8:10 ` Yue Hu [this message]
2020-12-22 9:13 ` Gao Xiang
2020-12-22 9:27 ` Gao Xiang
2020-12-22 9:30 ` Yue Hu
2020-12-22 9:39 ` Gao Xiang
2020-12-22 9:46 ` Yue Hu
2020-12-22 9:59 ` Gao Xiang
2020-12-22 10:17 ` Yue Hu
2020-12-22 10:33 ` Gao Xiang
2020-12-22 11:07 ` Yue Hu
2020-12-22 10:34 ` Yue Hu
2020-12-22 10:47 ` Gao Xiang
2020-12-24 3:45 ` Yue Hu
2020-12-24 4:19 ` Gao Xiang
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=20201222160935.000061c3.zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=hsiangkao@redhat.com \
--cc=huyue2@yulong.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.org \
/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