Bug 1271407 - emacs leaves behind corrupted symlinks on CIFS share
Summary: emacs leaves behind corrupted symlinks on CIFS share
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: emacs
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Synacek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-13 22:13 UTC by Charles R. Anderson
Modified: 2016-10-18 15:53 UTC (History)
16 users (show)

Fixed In Version: emacs-25.1-2.fc25 emacs-25.1-2.fc24
Clone Of:
: 1384153 (view as bug list)
Environment:
Last Closed: 2016-10-15 16:09:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1383968 0 unspecified CLOSED Creating a symlink with a colon in its name results in a corrupted file name 2021-02-22 00:41:40 UTC

Internal Links: 1383968

Description Charles R. Anderson 2015-10-13 22:13:57 UTC
Description of problem:
Emacs creates a corrupted symlink on a CIFS share when editing a file, and then fails to delete it when closing the file.  This doesn't happen for local files.


Version-Release number of selected component (if applicable):
emacs-24.5-2.fc21.x86_64
kernel-4.1.6-100.fc21.x86_64

How reproducible:
always

Steps to Reproduce:
1. emacs /path/to/CIFS/mount/foo
2. start making changes
3. look at the .#foo symlink created, it has a funny character between the PID and another large number.
4. Save and exit emacs.
5. The symlink stays behind and is not deleted.

Actual results:

CIFS share shows a funny character in the symlink:

-rw-rw-r--. 1 cra cra        0 Oct 13 18:04 foo
lrwxrwxrwx. 1 cra cra       39 Oct 13  2015 .#foo -> cra1441383545

The funny character between 3315 and 1441383545 is "ef 80 a2" in hex:

>cat | hexdump -C 

00000000  ef 80 a2 0a                                       |....|
00000004

Local file (ext4) shows no funny character:

-rw-r-----.   1 cra cra      9 Oct 13 18:04 foo
lrwxrwxrwx.   1 cra cra     37 Oct 13 18:09 .#foo ->  cra:cra.edu.3346:1441383545

Expected results:
No funny character in the symlink content.  The symlink should be removed by emacs upon closing the file.

Additional info:
The CIFS server is Centos 5 running samba-3.0.33-3.40.el5_10.

Comment 1 Charles R. Anderson 2015-10-13 22:16:14 UTC
Correction to Local file (ext4) shows no funny character:

-rw-r-----.   1 cra cra      9 Oct 13 18:04 foo
lrwxrwxrwx.   1 cra cra     37 Oct 13 18:09 .#foo -> cra:1441383545

Comment 2 Fedora End Of Life 2015-11-04 10:11:54 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2015-12-02 15:41:06 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Charles R. Anderson 2016-01-25 22:08:22 UTC
Still an issue with F23.  Maybe this is a Samba bug rather than an Emacs bug?

Comment 5 Charles R. Anderson 2016-01-25 22:11:05 UTC
I think this is an Emacs bug.  The same problem happens with symlinks on a CIFS share from a samba-3.0.33-3.40.el5_10 EL5 server and also a samba-4.2.3-11.el7_2.x86_64 EL7 server.

Comment 6 Charles R. Anderson 2016-07-22 13:45:51 UTC
Still exists on Fedora 24.

emacs-25.0.95-2.fc24.x86_64
kernel-4.6.4-301.fc24.x86_64

Comment 7 Jan Synacek 2016-10-10 11:56:34 UTC
This still happens with emacs-25.1-1.fc24.x86_64.

You can work around this by turning off interlocking:

(setq create-lockfiles nil)

Reported at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24656.

Comment 8 Paul Eggert 2016-10-11 19:45:30 UTC
This is a bug in Samba, not in Emacs. I can reproduce the bug without Emacs on a CIFS file system (locally mounted, Fedora 24) by running this simple C program:

#include <unistd.h>
int main (void) { return symlink ("a:b", "f") != 0; }

This creates a symbolic link from "f" to "a<F022>b", where "<F022>" stands for the UTF-8 representation for U+F022, i.e., the bytes EF, 80, A2.

Comment 9 Jan Synacek 2016-10-12 09:18:57 UTC
The workaround can be found at http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1dd54e3eef7543720eff161457677a35fae2435c.

Comment 10 Paul Eggert 2016-10-12 15:28:57 UTC
Since the bug is in Samba, the "Component" field of this bug report should be changed from "emacs" to "samba".

Comment 11 Charles R. Anderson 2016-10-12 15:50:45 UTC
(In reply to Paul Eggert from comment #10)
> Since the bug is in Samba, the "Component" field of this bug report should
> be changed from "emacs" to "samba".

How is using a character that isn't allowed on a specific filesystem considered to be a bug in that filesystem?  It seems to me to be an emacs bug to assume that any character is allowed to be used... If emacs tried to use '/' in a filename it wouldn't be considerd a bug in Ext4 would it?  Just like '/' is a path separator in Unix filesystems, ':' is a path separator in other filesystems.

Comment 12 Paul Eggert 2016-10-12 16:36:06 UTC
(In reply to Charles R. Anderson from comment #11)

> How is using a character that isn't allowed on a specific filesystem
> considered to be a bug in that filesystem?

First, the contents of a symbolic link do not have to be a file name, which means that file system restrictions are irrelevant in symlink contents. I can create a symbolic link from 'foo' to 'a:/never/never/land', and that's OK even if 'a:/never/never/land' does not and cannot exist.

Second, the file system in question was a Fedora tmpfs file system mounted via CIFS, and this specific file system (tmpfs) does allow ':' in file names. CIFS should not arbitrarily exclude ':' when both client and server allow ':' in file names.

Comment 13 Charles R. Anderson 2016-10-12 16:44:16 UTC
(In reply to Paul Eggert from comment #12)
> (In reply to Charles R. Anderson from comment #11)
> 
> > How is using a character that isn't allowed on a specific filesystem
> > considered to be a bug in that filesystem?
> 
> First, the contents of a symbolic link do not have to be a file name, which
> means that file system restrictions are irrelevant in symlink contents. I
> can create a symbolic link from 'foo' to 'a:/never/never/land', and that's
> OK even if 'a:/never/never/land' does not and cannot exist.
> 
> Second, the file system in question was a Fedora tmpfs file system mounted
> via CIFS, and this specific file system (tmpfs) does allow ':' in file
> names. CIFS should not arbitrarily exclude ':' when both client and server
> allow ':' in file names.

Okay, I'll clone this bug for samba then, but leave this one as-is so the emacs workaround can be released for Fedora.  We need the workaround since Samba servers won't necessarily be upgraded on the same schedule as Fedora clients.

Comment 14 Alexander Bokovoy 2016-10-12 16:48:26 UTC
To make clear: this is not a samba bug. It is a cifs.ko bug, e.g. kernel side.

Comment 15 Charles R. Anderson 2016-10-12 16:50:26 UTC
Please apply this patch to emacs and relase updates for all supported Fedora releases:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1dd54e3eef7543720eff161457677a35fae2435c

Thanks!

Comment 16 Jan Synacek 2016-10-13 06:14:43 UTC
I'm already working on it. Also, after comment#9, you can see that I have already created a bug for samba. Please, leave this bug on emacs.

Comment 17 Fedora Update System 2016-10-14 03:20:52 UTC
emacs-25.1-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b839b149bf

Comment 18 Fedora Update System 2016-10-14 04:56:18 UTC
emacs-25.1-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-3c06e0bcf6

Comment 19 Fedora Update System 2016-10-15 16:09:34 UTC
emacs-25.1-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2016-10-18 15:53:40 UTC
emacs-25.1-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.