Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions of alsatplg -o output are hardcoded to S_IRUSR | S_IWUSR (600) #126

Closed
marc-hb opened this issue Dec 11, 2021 · 2 comments
Closed

Comments

@marc-hb
Copy link
Contributor

marc-hb commented Dec 11, 2021

From https://github.com/alsa-project/alsa-utils/blob/c8c348e28a258f17e3/topology/topology.c#L172

static int save(const char *output_file, void *buf, size_t size)
{

               fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);

When using alsatplg in a build system (e.g.: https://github.com/thesofproject/sof/blob/3e1c160e5053eae/tools/topology/topology1/CMakeLists.txt#L243), all other artefacts follow the process's umask except alsatplg output. This causes subtle and time-consuming errors when trying to share artefacts across different processes.

git blame finds:

commit cbabe7a
Author: Jaroslav Kysela perex@perex.cz
Date: Thu Dec 19 15:36:05 2019 +0100

alsatplg: rewrite to use the new libatopology functions

Before cbabe7a, opening the output file was delegated to library function snd_tplg_build_file(). Not sure what permissions were used then.

Workaround:

alsatplg -c intput.conf -o - > output.tplg
@perexg
Copy link
Member

perexg commented Dec 12, 2021

Thank you for your report. It's fixed now in 8e71fba. The problem was in the original code in alsa-lib, too. Several Intel people touched the code and the result ends with this too restrictive permission settings.

@marc-hb
Copy link
Contributor Author

marc-hb commented Dec 12, 2021

Thanks @perexg for the super quick fix.

Several Intel people touched the code and the result ends with this too restrictive permission settings.

git blame can be cruel :-) Looks like that change was trying to remove spurious exec permissions and went too far. Hard to tell for sure because it's just one line drown in a much bigger commit.

marc-hb added a commit to marc-hb/sof that referenced this issue Dec 13, 2021
Use a redirection to work around hardcoded alsatplg permissions.
See bug alsa-project/alsa-utils#126

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
lgirdwood pushed a commit to thesofproject/sof that referenced this issue Dec 14, 2021
Use a redirection to work around hardcoded alsatplg permissions.
See bug alsa-project/alsa-utils#126

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants