After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 364843 - Keep "reallylongfilename (copy).txt" from reaching the maximum path length
Keep "reallylongfilename (copy).txt" from reaching the maximum path length
Product: nautilus
Classification: Core
Component: File and Folder Operations
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 530844 (view as bug list)
Depends on:
Reported: 2006-10-24 22:25 UTC by Federico Mena Quintero
Modified: 2008-05-08 19:32 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16

nautilus-name-length.patch (14.14 KB, patch)
2006-10-24 22:26 UTC, Federico Mena Quintero
none Details | Review
nautilus-bgo364843-name-copy-dont-overflow-max-path-len.diff (15.85 KB, patch)
2008-04-21 21:07 UTC, Federico Mena Quintero
accepted-commit_now Details | Review

Description Federico Mena Quintero 2006-10-24 22:25:36 UTC
The various names that get generated for copied files ("file (copy).txt") can overflow the maximum allowed length for pathnames.  The attached patch fixes this.
Comment 1 Federico Mena Quintero 2006-10-24 22:26:33 UTC
Created attachment 75333 [details] [review]
Comment 2 Federico Mena Quintero 2008-04-21 21:07:07 UTC
Created attachment 109652 [details] [review]

This one is updated for nautilus-2.22.2.
Comment 3 A. Walton 2008-05-03 11:02:27 UTC
*** Bug 530844 has been marked as a duplicate of this bug. ***
Comment 4 Christian Neumair 2008-05-03 12:39:13 UTC
Thanks for your efforts. Please commit it to trunk and the GNOME 2.22 branch.
Comment 5 Federico Mena Quintero 2008-05-08 19:32:20 UTC
Thanks, Manny!  Submitted to trunk and GNOME_2_22.

2008-05-08  Federico Mena Quintero  <>

        Keep the generated names for "reallylongfilename (copy).txt" from
        overflowing the maximum allowed length for path names.

        Original patch by Dave Camp <>

        * libnautilus-private/nautilus-file-operations.c
        (shorten_utf8_string): New function; takes an UTF8 string and
        hygienically truncates it to a given number of bytes.
        (get_link_name): Ensure the final name doesn't exceed a maximum length.
        (make_next_duplicate_name): Likewise.
        (get_max_name_length): Wrapper around pathconf() for basename lengths.
        (get_unique_target_file): Use a maximum length for the target name.
        (get_target_file_for_link): Likewise.