Skip to content

libmount: mnt_fs_get_uniq_id return 0 without HAVE_STATMOUNT #3948

@meven

Description

@meven

Documentation as of 2.41, states:

mnt_fs_get_uniq_id ()

uint64_t
mnt_fs_get_uniq_id (struct libmnt_fs *fs);

This ID is provided by statmount() or statx(STATX_MNT_ID_UNIQUE) since Linux kernel since v6.8.

But in https://github.com/util-linux/util-linux/blob/master/libmount/src/fs.c#L1491 the uniq_id is not fetched if !HAVE_STATMOUNT contradicting the documentation.

I would expect a statx fallback code path.

Maybe I missed something but:

    if (struct libmnt_table *table = mnt_new_table()) {

          if (mnt_table_parse_mtab(table, nullptr) == 0) {
            struct libmnt_iter *itr = mnt_new_iter(MNT_ITER_FORWARD);
            struct libmnt_fs *fs;

            while (mnt_table_next_fs(table, itr, &fs) == 0) {
                printf( "\\d", mnt_fs_get_uniq_id(fs)); 
            }

            mnt_free_iter(itr);
        }

        mnt_free_table(table);
    }

Always return 0.

Maybe I am missing something, but the documentation does tell what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BLOCKERRequired for the next release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions