#1948 rm: File or path name too long

Chris Johns

GCC 4.7.2 is a single tarball with the testsuite and Java and this makes long paths. Attempting to remove the gcc-4.7.2 source tree from the top is failing .....

$ rm --version
rm (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License http://www.gnu.org/licenses/gpl.html.
There is NO WARRANTY, to the extent permitted by law.

Written by Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering.

chris@popov rtems $ uname -a
MINGW32_NT-6.1 POPOV 1.0.16(0.48/3/2) 2011-04-01 11:21 i686 Msys
chris@popov rtems $ pwd
chris@popov rtems $ rm -rf build
rm: cannot lstat build/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2/gcc-4.7.2/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java': File or path name too long rm: cannot lstatbuild/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2/gcc-4.7.2/libjava/classpath/lib/javax/management/MBeanServerPermission$MBeanServerPermissionCollection$MBeanServerPermissionEnumeration.class': File or path name too long
rm: cannot lstat build/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2/gcc-4.7.2/libjava/classpath/lib/javax/swing/plaf/metal/MetalInternalFrameTitlePane$MetalInternalFrameTitlePanePropertyChangeHandler.class': File or path name too long rm: cannot lstatbuild/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2/gcc-4.7.2/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet$DocErrorReporterOutputStream.class': File or path name too long
rm: cannot lstat build/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2/gcc-4.7.2/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletConfigurationException.class': File or path name too long chris@popov rtems $ pushd build/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2/ /c/opt/rtems/src/rsb/rtems/build/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2-1/sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2 /c/opt/rtems/src/rsb/rtems chris@popov sparc-rtems4.11-gcc-4.7.2-newlib-1.20.0-1-4.7.2 $ rm -rf gcc-4.7.2 rm: cannot lstatgcc-4.7.2/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java': File or path name too long
rm: cannot lstat gcc-4.7.2/libjava/classpath/lib/javax/management/MBeanServerPermission$MBeanServerPermissionCollection$MBeanServerPermissionEnumeration.class': File or path name too long rm: cannot lstatgcc-4.7.2/libjava/classpath/lib/javax/swing/plaf/metal/MetalInternalFrameTitlePane$MetalInternalFrameTitlePanePropertyChangeHandler.class': File or path name too long
rm: cannot lstat gcc-4.7.2/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTranslet$DocErrorReporterOutputStream.class': File or path name too long rm: cannot lstatgcc-4.7.2/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/xmldoclet/doctranslet/DocTransletConfigurationException.class': File or path name too long


  • Earnie Boyd

    Earnie Boyd - 2013-03-12
    • status: unread --> closed
    • type: Bug --> Support
    • resolution: none --> out-of-date
    • category: Unknown --> Behaves_as_Documented
  • Chris Johns

    Chris Johns - 2013-03-12

    Are you saying 'rm' is being limited by the operating system ?

    • Earnie Boyd

      Earnie Boyd - 2013-03-12

      Exactly that. The maximum path limit is 260 characters and that includes the trailing NULL. There are some workarounds that can cause the MAX_PATH limit to be 32000 and current Cygwin may do those already.

  • Earnie Boyd

    Earnie Boyd - 2013-03-12

    Accidentally set the resolution as out-of-date. It should have remained as none.

  • Earnie Boyd

    Earnie Boyd - 2013-03-12
    • resolution: out-of-date --> none
  • Chris Johns

    Chris Johns - 2013-03-12

    Something does not make sense. If there is a limit and it is related to the Windows API, how was the path created in the first place ? If this limit is the whole path then it should never have been allowed to be created and if it is a component that is different. POSIX for 'rm' states:

    "The rm utility shall be able to descend to arbitrary depths in a file
    hierarchy, and shall not fail due to path length limitations (unless
    an operand specified by the user exceeds system limitations)."

    I suppose the issue is the "operand" in this case is the path I pass on the command line and that is over the limit. I still feel there is a question about the upstream 'rm' tool handling this if it is POSIX.

  • Chris Johns

    Chris Johns - 2013-03-31

    This proved to be a blocker and on reviewing the response in this ticket I moved to building RTEMS tools using Cygwin and a Canadian cross build process with Cygwin 64bit MinGW tools. Best of luck with MSYS2.

  • sam locas

    sam locas - 2014-02-25

    For such issues, you can use long path tool as well, it works good.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks