What exactly is the GNU tar ././@LongLink “trick”?

前端 未结 2 1763
死守一世寂寞
死守一世寂寞 2020-12-28 17:33

I read that a tar entry type of \'L\' (76) is used by gnu tar and gnu-compliant tar utilities to indicate that the next entry in the archive has a \"long\" name. In this c

2条回答
  •  一向
    一向 (楼主)
    2020-12-28 17:58

    Note that the information about all of that can be found in the libtar project:

    http://www.feep.net/libtar/

    The proposed header is libtar.h (opposed to the POSIX tar.h) which clearly includes a long filename, and long symbolic link.

    Get the "fake" headers + data for the long filenames/links then the "real" header (except for the actual filename and symbolic link) after that.

    HEADER type 'L'
    BLOCKS of data with the real long filename
    HEADER type 'K'
    BLOCKS of data with the real symbolic link
    HEADER type '0' (or '5' for directory, etc.)
    BLOCKS of data with the actual file contents
    

    Of course, under MS-Windows, you probably won't handle symbolic links, although with Win7 it is said that symbolic links under MS-Windows are working (finally.)

    Pertinent definition from libtar.h:

    /* GNU extensions for typeflag */
    #define GNU_LONGNAME_TYPE   'L'
    #define GNU_LONGLINK_TYPE   'K'
    

提交回复
热议问题