# \`mender-artifact install\` doesn't respect the provided mode

**URL:** <https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187>\
**Category:** General Discussions\
**Tags:** mender-artifact\
**Created:** [October 25, 2019, 12:55pm UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187 "2019-10-25T12:55:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbaxter-izo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sbaxter-izo/32/548_2.png) [@sbaxter-izo](https://hub.mender.io/u/sbaxter-izo)\
**Post date:** [October 25, 2019, 12:55pm UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187/1 "2019-10-25T12:55:06Z")

</div>

I’m using `mender-artifact install -m <mode> <src> <dst>` to install files into a mender artifact, but I’m seeing the file created with the same permissions as the `src` file, instead of permissions set by the `mode` flag.

Here are the steps I’m following:

```
$ stat -c %a src_file
644
$ mender-artifact install -m 0777 src_file artifact.mender:/dst_file
$ tar -xf artifact.mender
$ tar -xzf data/0000.tar.gz
$ debugfs file-system.ext4
debugfs: stat /dst_file
Inode: 3958 Type: regular Mode: 0600 Flags: 0x80000
Generation: 0 Version: 0x00000000
User: 0 Group: 0 Size: 23707147
File ACL: 0
Links: 1 Blockcount: 46304
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5db20f50 -- Thu Oct 24 20:53:36 2019
atime: 0x5db20f50 -- Thu Oct 24 20:53:36 2019
mtime: 0x5db20f50 -- Thu Oct 24 20:53:36 2019

```

I’ve added some logic to the `mender-artifact install` command to verify the `mode` value I’m passing in is being parsed correctly (`0755` parses as `-rwxr-xr-x` for instance), but it seems like the `mode` value is not available at the time we actually create the `dst` file with a `debugfs` command.

I noticed there’s also a unit test in `copy_test.go` for `Install file, standard permissions (0600)`, but it’s failing on my machine. Has anyone seen similar behavior or have an idea what’s going on here?

I’m happy to dig in and experiment a little, but I’m not super familiar with Go. Thanks for the help!

---

<div class="post-metadata">

**Author:** ![sbaxter-izo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sbaxter-izo/32/548_2.png) [@sbaxter-izo](https://hub.mender.io/u/sbaxter-izo)\
**Post date:** [October 25, 2019, 1:02pm UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187/2 "2019-10-25T13:02:03Z")

</div>

Ah, I should call out, I’m using `mender-artifact` v3.1.0

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [October 25, 2019, 1:49pm UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187/3 "2019-10-25T13:49:37Z")

</div>

Tagging @oleorhagen

---

<div class="post-metadata">

**Author:** ![sbaxter-izo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sbaxter-izo/32/548_2.png) [@sbaxter-izo](https://hub.mender.io/u/sbaxter-izo)\
**Post date:** [October 25, 2019, 3:56pm UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187/4 "2019-10-25T15:56:12Z")

</div>

> [@sbaxter-izo](#):
>
> I noticed there’s also a unit test in `copy_test.go` for `Install file, standard permissions (0600)` , but it’s failing on my machine.

^ This isn’t quite the right description. This test passes on the mainline 3.1.0 tag, but it fails if I change the test to try installing different permissions. It seems like all files installed with `-m` get created with the standard `0600` permissions.

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [October 29, 2019, 10:07am UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187/5 "2019-10-29T10:07:04Z")

</div>

hi @sbaxter-izo. I have been able to reproduce this, and you are absolutely right of course. Created a ticket for it here: [https://tracker.mender.io/browse/MEN-2880](https://tracker.mender.io/browse/MEN-2880), if you would like to follow the progress.

---

<div class="post-metadata">

**Author:** ![sbaxter-izo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sbaxter-izo/32/548_2.png) [@sbaxter-izo](https://hub.mender.io/u/sbaxter-izo)\
**Post date:** [October 29, 2019, 2:41pm UTC](https://hub.mender.io/t/mender-artifact-install-doesnt-respect-the-provided-mode/1187/6 "2019-10-29T14:41:51Z")

</div>

Great, thanks for the link. I’ll keep an eye out for fixes.
