[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: parted is ALMOST suitable



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Nov 07, 2016 at 07:54:23PM +0300, Reco wrote:
> 	Hi.
> 
> On Mon, Nov 07, 2016 at 04:05:17PM +0100, tomas@tuxteam.de wrote:
> > On Mon, Nov 07, 2016 at 09:35:32AM -0500, Greg Wooledge wrote:
> > > I started writing that in my previous message, but then I actually
> > > tested it on my own system.  Good thing I did, because I got the
> > > same result as Richard: being in group disk, which has read/write
> > > access on /dev/sda*, does NOT give you output in the FSTYPE and other
> > > fields of lsblk -f.  It certainly surprised me.
> > 
> > Indeed. I suspect lsblk is checking the user ID itself instead of
> > letting the OS do its thing. For whatever reasons I can't fathom.

[...]

> The definition of this function contains this little gem (getuid call):

[...]

>     /* try libblkid (fallback) */
>     if (getuid() != 0)
>         return;             /* no permissions to read from the device */

[...]

> I.e. insufficient device permissions will return NULL anyway, so there's
> little point of checking whenever the calling user is root or not.

Hey, thanks for actually following through. My dirty imagination was
right, for one time :-)

Actually this is an anti-pattern: trying to do a job in advance before
the "right" architecture layer has a chance at doing a better job.
More complexity, less functionality.

regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlghmDQACgkQBcgs9XrR2kaAoACfTYpAbwbTnMVeqP6Dldyyo/M1
96sAn1VIzOsjtUpCFhQzuG/rvO2Ja/yA
=LN4U
-----END PGP SIGNATURE-----


Reply to: