Patheos

BuddhistCatholicContemplativeEvangelicalGeneral ChristianHinduJewishLatter-day SaintMuslimNew VisionsProgressive Christian

Beliefs

Topics

Columnists

Resource Library

Research Tools

Video

Podcasts

Thought Readers

Faith In Media Tracker

Newsletters

Ad-Free & Subscriber Log-In Subscription Support

Patheos

Ad-Free & Subscriber Log-In Subscription Support

Follow Patheos Patheos on Facebook Patheos on YouTube

Cry 'Woof'

Sudo, Sudon’t: Decreasing the Cognitive Load

Last updated on: September 20, 2014 at 8:00 am   by willduquette

Sudo, Sudon’t: Decreasing the Cognitive Load 2014-09-19T18:01:42-05:00 willduquette

LOGO Patheos Explore the world's faith through different perspectives on religion and spirituality! Patheos has the views of the prevalent religions and spiritualities of the world.

Quill Last week I talked about the joys of using the “sudo” command to manage resources installed as “root” on Unix-like systems, and some of the unpleasant links you have to jump through in the name of security.

The context of the discussion was ActiveTcl’s “teapot”, which is a repository of Tcl library packages available to all Tcl programmers on the machine. That’s a very good thing; and it’s because the teapot serves all users that it’s installed in a central position that’s owned by “root”.

ActiveTcl comes with a program inevitably called “teacup”; teacup allows you to install new library packages from a repository on a web server into your local teapot, and if you install them into the default teapot then everyone on the machine can use them. But you have to use “sudo”.

Quill has a different model for external library packages. Your project keeps a list of the external libraries it needs in its “project file”, and Quill goes out and retrieves the libraries over the ‘net and installs them in the teapot. The following command retrieves all missing libraries:

$ quill deps update

Mind you, it’s still using “teacup” in the background…but it’s one command, rather than several. That’s the idea. But if you install them into the default teapot, which is owned by “root”, you need to use “sudo”:

$ sudo quill deps update

And that might or might not work, for the reasons I discussed last week: Quill needs to search for the “teacup” executable, and if “sudo” hides its environment variables, Quill can’t find it. And it’s bad idea anyway: the programmer has to trust that Quill isn’t going to do anything nasty (either accidentally or on purpose), and why should he have to worry about that?

The goal, then, is to arrange matters so that we don’t need to use “sudo” on a regular basis.

It so happens that ActiveTcl allows you to have an arbitrary number of teapots on your machine; and so the obvious solution is to create a teapot in the user’s home directory. Then we can use “teacup” to install any needed packages there, instead of into the central teapot. That turns out to work pretty well; and it takes just a few “teacup” commands to set it up:

$ teacup create ~/.quill/teapot
$ teacup default ~/.quill/teapot
$ sudo teacup link ~/.quill/teapot `which tclsh`

Quill can do the first couple, but that last one, “teacup link”, unavoidably requires “sudo”; and Quill can’t execute it for the user, for the reasons given above. What to do?

After a couple of false starts, I came up with the following.

First, the quill teapot command determines whether the current teapot configuration is adequate. If it is, and no “sudo” commands are needed, then there’s no more to be done.

Second, the quill teapot fix command outputs a “fixteapot” script that takes all necessary steps. The details will change from machine to machine but it’s going to look something like this:

/usr/local/bin/teacup default /home/will/.quill/teapot
/usr/local/bin/teacup link /home/will/.quill/teapot /usr/local/bin/tclsh
...

Notice that the “teacup” and “tclsh” executables are given their full paths, so that the “which” command isn’t needed, and the location of the new teapot is also given in full. There’s nothing to look up, no environment to worry about.

The programmer using Quill can then look at the “fixteapot” script and either run the whole thing using “sudo” or run the individual commands by themselves; it’s up to him and what he’s comfortable with. And no one ever needs to run Quill under “sudo”, which eliminates a major source of worries.

Quill

quill build tool

tcl/tk

Previous Post



September 19, 2014

Remembering Dionne Warwick and Burt Bacharach

Next Post



September 21, 2014 The Enlightened Family: Why, It All Makes Sense!


Browse Our Archives

Select a Category Admin App o' the Morning Ask the Dogmat Believing Thomas Bits of Fiction Blasts from the Past Bootstrapping the Interior Life Catholic Mom Christian Living Deep Thoughts from the Doghouse Dominicana Evangelii Gaudium Interviews It Was A Dark and Stormy Night Links to This and That Lumen Fidei Meme Watch On Writing Operation Gratitude Pedant Errant Photography Quill Random Barkings S'Mary's World Shakers of Salt Software Development The Dog Whistler The Dogmat Sez Third Orders Thomas Aquinas Uncategorized Vikings at Dinos Woof Guide to Cinema Woof Guide to History Woof Guide to Literature Woof Guide to Obscure Catholic Music Woof Guide to Philosophy Woof Guide to Popular Music Woof Guide to Technology Woof Guide to Theology Words I Wish I'd Written Works For Me

Select a Month September 2016 August 2016 June 2016 May 2016 April 2016 March 2016 February 2016 January 2016 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2015 December 2014 November 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March 2014 February 2014 January 2014 December 2013 November 2013 October 2013


Follow Us!

Follow Us on Facebook Follow Us on Twitter



TAKE THE

Religious Wisdom Quiz

Which Old Testament prophet confronted King Ahab about worshiping Baal?

Select your answer to see how you score.

Isaiah Jeremiah Elijah Ezekiel

Related posts from Cry 'Woof'

Catholic

Quill v0.4.0

Cry 'Woof'

Catholic

Coding Beyond The Screen, Part I

Cry 'Woof'

Catholic

Portland, O Portland

Cry 'Woof'

Catholic

Quill v0.3.0

Cry 'Woof'

TRENDING AT PATHEOS Catholic

Rejecting Doom: Christian Hope And Human Action

Christianity is a religion of hope. We are to have hope and...

It’s What Comes From Within Which Matters

One of the most difficult things for us to understand is why...

Why I Choose the Eucharist Over the Sermon

Choose the Eucharist, Not the Sermon What are we supposed to get...

5 Design Elements Found in Spiritually Rooted Homes

Putting Spirituality Into Home Decor Our homes are more than our living...

Credo: A Story of God Told with the...

About 10 years ago, I began to imagine a personal "Credo" that...

The Anatomy of Divine Revelation in Catholic Thought

The claim that God has made Himself known to human beings is...

view all Catholic blogs

Patheos on Facebook Patheos on YouTube

Ad-Free & Subscriber Log-In Subscription Support

Copyright 2008-2026, Patheos. All rights reserved.

Subscription Support Ad-Free & Subscriber Log-In

Follow Patheos Patheos on Facebook Patheos on YouTube