Comment 5 for bug 120490

Revision history for this message
Alexander Perlis (alexanderperlis) wrote : Re: [Bug 120490] Re: quota only displays the first automounted file-system

Ian Taylor asked:

> Is this really a bug?

It's not a "bug" insofar as functionality is concerned: the quota numbers are reported correctly, quotas are enforced correctly. It
is simply confusing to user1 that when they issue "quota" they
are misled into believing someone else's quota is being reported.

> Doesn't user1 have a quota for the /home/user2 mount point
> since /home/user1 and /home/user2 are on the same filesystem?
> (He just can't create anything there due to permissions).

Yes. In fact, now that I think about it, the quota tool has no way of knowing, when
there are multiple mountpoints for the same file system, *which* one to
display in its output, i.e., which one will cause the least confusion.

Currently, I believe it simply shows the *first* mountpoint. (Command "quota -A" shows all of them.)

> It's annoying and I'm looking for a solution, but it doesn't
> seem like the quota tool should treat it as a special case.
> Anyone know how to make this cleaner?

The following logic might cover the majority of cases:

  (1) With the "-A" option, proceed as today: show all mountpoints in output.

  (2) Without "-A", for a given filesystem that would lead to a line of output, first build a list in memory of all the mountpoints for that filesystem.

    (2A) If the home directory path (of the uid on which quota is currently reporting) appears at or below at least one of the members of the list from (2), then prune that list, keeping only the entries that involve the home directory path. (But if none of the entries contain the home directory, then don't prune at all.)

    (2B) From the list that remains, print out the first entry.

    (2C) If the list contains more than one entry, set a boolean flag for (3) below.

  (3) After all filesystems are reported, check the flag from (2C), and append a message at the end, "At least one reported filesystem has multiple mountpoints. Use -A to see all mountpoints."

With this logic, I believe in most cases user1 will see output involving a mountpoint that looks familiar to them. But if not, at least they get a message telling them to try again with "-A", and then they'll hopefully find the line they're expecting to see. Ultimately, I believe the proposed logic will reduce user confusion.

Thanks.
Alexander