Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#79830 - vim 9.0.1968-1 error message about extended attribute errror

Attached to Project: Arch Linux
Opened by Gene (GeneC) - Sunday, 01 October 2023, 14:47 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 03 October 2023, 06:06 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
- Edit an existing text file and save generates error:

E1509: Error occured when reading or writing extended attribute

In spite of this, the file is written out just fine.

- Prev version of vim (9.0.1882-1) works fine (as does vi)

- File system is ext4 : tune2fs shows

Filesystem features: has_journal ext_attr resize_inode dir_index fast_commit
filetype needs_recovery extent 64bit flex_bg sparse_super large_file
huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl

Additional info:
* package version(s) vim 9.0.1968-1


Steps to reproduce:
- Edit an existing text file and write it out

- Other tests:

1) If I copy the file to /tmp and edit and save it - that works fine with no error.

2) If I copy the file to new name but in same directory - it has same problem.'

3) if I edit a 'new' file on same directory I get no errors and its fine
however if i then read same file back in and write - I get same error.

Rolling back to vim 9.0.1882-1 and all is fine again.

This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 03 October 2023, 06:06 GMT
Reason for closing:  Upstream
Additional comments about closing:  Thanks for that. Assuming we'll get the fix in the next update.
Comment by loqs (loqs) - Sunday, 01 October 2023, 18:03 GMT
Is there an upstream bug report? Was the issue introduced by [1]?

[1] https://github.com/vim/vim/commit/e085dfda5d8dde064b0332464040959479696d1c
Comment by Gene (GeneC) - Sunday, 01 October 2023, 19:09 GMT
@loq - that commit sure looks like it changed things.

When I run getfattr -m '' on a file I get:
security.SMACK64

So if I now do
touch foo
sudo setfattr -x security.SMACK64 foo

getfattr -m '' foo -> no more extended atrib.

Then sure enough vim has no problem any more.


Comment by Gene (GeneC) - Sunday, 01 October 2023, 19:19 GMT
Forgot to say. If I try setfattr as the non-root owner of the file - i get permission denied.
So seems that is likely the underlying problem.

The vim code does the programmatic version setxattr() - and likely it gets permission denied.


Comment by Gene (GeneC) - Sunday, 01 October 2023, 19:28 GMT
Unless I am the only one impacted, i guess one option would be to compile vim using the new build option --disable-xattr
I don't know why vim is calling setxattr() on the edited file but maybe it's not, and one possibility might be for a backup file or something.
I didn't read all the code - was a swift glance.
But around line 1513 it does look like copying the xattr to backup:

https://github.com/vim/vim/pull/13203/commits/23fff2bc6a8a379faf742998e9042269d6b6bb89
Comment by loqs (loqs) - Sunday, 01 October 2023, 20:35 GMT
I would suggest raising the issue with upstream before considering disabling xattr support. Perhaps upstream could consider EACCES (assuming that is the error returned from setxattr) as meaning just skip that attribute when not root / CAP_MAC_ADMIN.
Comment by Gene (GeneC) - Sunday, 01 October 2023, 22:50 GMT
Yes that makes sense
Comment by Gene (GeneC) - Sunday, 01 October 2023, 22:55 GMT
Seems to be an upstream PR for this already:

https://github.com/vim/vim/pull/13229

Comment by loqs (loqs) - Sunday, 01 October 2023, 23:13 GMT
>Seems to be an upstream PR for this already:
> https://github.com/vim/vim/pull/13229

Looks to me to be fixing build time detection of xattr not runtime error handling.
Comment by Gene (GeneC) - Sunday, 01 October 2023, 23:31 GMT Comment by Gene (GeneC) - Monday, 02 October 2023, 11:43 GMT
This patch fixes the problem for me - I shared this upstream as well.
Comment by Gene (GeneC) - Monday, 02 October 2023, 21:23 GMT Comment by Gene (GeneC) - Monday, 02 October 2023, 23:02 GMT
Upstream fix is in 9.0.1975.

Loading...