The Value Of Text-Based Config Files

Discussion in 'NZ Computing' started by Lawrence D'Oliveiro, Apr 15, 2010.

  1. Yesterday I upgraded the main server for a client of mine from Debian 4.0 to
    version 5.0. In order to minimize downtime, I opted to do an in-place
    upgrade (after backing up the existing OS installation, of course). That
    way, the server would continue to be available for at least part of the time
    the upgrade was taking place.

    Now, replacing new versions of libraries, executables etc for old ones is
    the easy part. The potentially tricky part is what do you do with new
    versions of system config files. Where the old one has not been modified
    from the default, that’s fine—just replace the old default with the new one.
    But for one where the admin has made some customizations, a bit more care is
    needed.

    I have developed this habit where, before modifying a system config file, I
    make a backup of the original version by appending “-orig†to its name. This
    makes it easy to get a quick list of all the places where I’ve made changes:

    find /etc -name \*-orig

    And of course to see the actual change(s) I’ve made, the diff tool is
    invaluable, e.g.

    diff -u /etc/ssh/sshd_config{-orig,}

    Sometimes where a subsystem has a whole bunch of config files, and I make
    changes to several of them, it’s easier to back up the whole subdirectory.
    Listing all the changes at once is still just as easy in this case, e.g.

    diff -ur /etc/asterisk{-orig,}/

    Getting back to the system upgrade, when the Debian installer detects that a
    config file that it wants to replace has been changed from the default, it
    offers you a chance to do a diff and decide whether you want to replace it
    with the new default or not. What I opted to do most of the time was make a
    note of the config file, let the installer put in the new default, then go
    back later over all these files (about a couple of dozen of them), after the
    installation was complete, to update them.

    Remember, I still had the backup of the old system, so I could easily
    redisplay my previous customizations:

    diff -u /home/backup/old_system/etc/config_file{-orig,}

    and try automatically applying the same change to the new installation using
    patch:

    diff -u /home/backup/old_system/etc/config_file{-orig,} | patch

    In some cases, this actually worked! But not in all. In those, I could still
    use the diff as a starting point to manually edit the new config file and
    copy and paste in the relevant bits.
    Lawrence D'Oliveiro, Apr 15, 2010
    #1
    1. Advertising

  2. Lawrence D'Oliveiro

    Gordon Guest

    On 2010-04-15, Lawrence D'Oliveiro <_zealand> wrote:
    > Yesterday I upgraded the main server for a client of mine from Debian 4.0 to
    > version 5.0. In order to minimize downtime, I opted to do an in-place
    > upgrade (after backing up the existing OS installation, of course). That
    > way, the server would continue to be available for at least part of the time
    > the upgrade was taking place.


    [snip]

    In other words humans can read text files.

    Ms Windows registry is something out of, well I'll let you know when I find
    out.

    Ms Penguin has lots of config files, instead of one. This does help as if
    you wish to study etc a programmes response you have a hell of a less to
    look at.

    Also, and this is important. It is in plain ASCII text, just like this
    message. This allows it to be commented which it means that the novices get
    very important clues as to what to type in.

    Windows is either pay or leave, people do.
    Gordon, Apr 15, 2010
    #2
    1. Advertising

  3. Lawrence D'Oliveiro

    John Little Guest


    > And of course to see the actual change(s) I’ve made, the diff tool is
    > invaluable, e.g.
    >
    >     diff -u /etc/ssh/sshd_config{-orig,}


    Better, IMO, gvimdiff (or vimdiff if no gui); the syntax of several
    config files is recognized, and the colouring speeds comprehension.

    Regards, John
    John Little, Apr 16, 2010
    #3
  4. On 15 Apr, 18:14, Gordon <> wrote:
    > On 2010-04-15, Lawrence D'Oliveiro <_zealand> wrote:
    >
    > > Yesterday I upgraded the main server for a client of mine from Debian 4.0 to
    > > version 5.0. In order to minimize downtime, I opted to do an in-place
    > > upgrade (after backing up the existing OS installation, of course). That
    > > way, the server would continue to be available for at least part of the time
    > > the upgrade was taking place.

    >
    > [snip]
    >
    > In other words humans can read text files.
    >
    > Ms Windows registry is something out of, well I'll let you know when I find
    > out.
    >
    > Ms Penguin has lots of config files, instead of one. This does help as if
    > you wish to study etc a programmes response you have a hell of a less to
    > look at.
    >
    > Also, and this is important. It is in plain ASCII text, just like this
    > message. This allows it to be commented which it means that the novices get
    > very important clues as to what to type in.
    >
    > Windows is either pay or leave, people do.


    The registry does have its advantages though. A nice standard clean
    tidy way of storing structured configuration data. A standard API for
    reading and writing values - no file parsing necessary. Gnome has
    something like it (GConf) and I think KDE does too. It makes it very
    easy to write a program which manages the configuration data - like a
    control panel or something.

    Of course, the registry is not very suitable for everything -
    configuration files do a better job for stuff like apache and samba.
    David Goodwin, Apr 16, 2010
    #4
  5. Lawrence D'Oliveiro

    AD. Guest

    On Apr 16, 1:20 pm, David Goodwin <> wrote:
    > The registry does have its advantages though. A nice standard clean
    > tidy way of storing structured configuration data. A standard API for
    > reading and writing values - no file parsing necessary. Gnome has
    > something like it (GConf) and I think KDE does too. It makes it very
    > easy to write a program which manages the configuration data - like a
    > control panel or something.


    IMO the registry itself isn't a problem, the main problem is the way
    most stuff in there is tied together with UUIDs.

    Thats what makes it unfriendly to humans and unportable.

    --
    Cheers
    Anton
    AD., Apr 16, 2010
    #5
  6. In message
    <>, David
    Goodwin wrote:

    > The registry does have its advantages though. A nice standard clean
    > tidy way of storing structured configuration data.


    Yeah, “standard†and “clean†are the first two words that come to mind when
    you think of the Windows Registry ... along with “so easy to {721922F4-
    DA0B-4A27-807C-CB08CC3F5F1A} a child could {B3833833-40A3-475C-8290-
    B91954E7E85D} itâ€, “efficientâ€, “reliableâ€, “{0C03692B-
    EE17-4AF6-92CE-45312CB1E384}†and “never ever a cause of system slowdown let
    alone complete failure, no {B3833833-40A3-475C-8290-B91954E7E85D} sirreeâ€
    ....

    > It makes it very easy to write a program which manages the configuration
    > data - like a control panel or something.


    Wonder why PowerShell makes it look like a filesystem made up of lots of
    little files, then...
    Lawrence D'Oliveiro, Apr 16, 2010
    #6
  7. In message <739edbf3-2b75-4f99-8026-
    >, John Little wrote:

    >> And of course to see the actual change(s) I’ve made, the diff tool is
    >> invaluable, e.g.
    >>
    >> diff -u /etc/ssh/sshd_config{-orig,}
    >> ...
    >> and try automatically applying the same change to the new installation
    >> using patch:
    >>
    >> diff -u /home/backup/old_system/etc/config_file{-orig,} | patch
    >>

    > Better, IMO, gvimdiff (or vimdiff if no gui); the syntax of several
    > config files is recognized, and the colouring speeds comprehension.


    Can it apply a difference as a patch as well?
    Lawrence D'Oliveiro, Apr 18, 2010
    #7
  8. Lawrence D'Oliveiro

    John Little Guest

    On Apr 18, 2:32 pm, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:

    > >> And of course to see the actual change(s) I’ve made, the diff tool is
    > >> invaluable, e.g.

    >
    > >> diff -u /etc/ssh/sshd_config{-orig,}
    > >> ...
    > >> and try automatically applying the same change to the new installation
    > >> using patch:

    >
    > >>    diff -u /home/backup/old_system/etc/config_file{-orig,} | patch


    and I remarked:

    > > Better, IMO, gvimdiff (or vimdiff if no gui); the syntax of several
    > > config files is recognized, and the colouring speeds comprehension.


    To which Lawrence said:

    > Can it apply a difference as a patch as well?


    No, you'd use diff, as vimdiff uses diff underneath. But why diff two
    files (say, x and x.orig) to generate a patch that is used to make
    them the same? Why not just copy the old to the new (cp x.orig x)?

    (BTW, diff -u x{-orig,) | patch complains about a reversed patch.)

    But the point is, we have rich tool sets for working with text files,
    and we become very experienced with some of those tools. Non text
    configuration methods shackle one to particular tools and APIs.

    Regards, John
    John Little, Apr 18, 2010
    #8
  9. In message <bc27bfba-d389-4cbe-
    >, John Little wrote:

    > But why diff two files (say, x and x.orig) to generate a patch that is
    > used to make them the same?


    No, I want to diff two files to create a patch for a third file. Given

    A - default config file for old system version
    B - customized config file for old system version
    C - default config file for new system version

    I want to apply the difference between A and B to C to create

    D - customized config file for new system version
    Lawrence D'Oliveiro, Apr 18, 2010
    #9
  10. Lawrence D'Oliveiro

    Enkidu Guest

    Lawrence D'Oliveiro wrote:
    > In message <739edbf3-2b75-4f99-8026-
    > >, John Little wrote:
    >
    >>> And of course to see the actual change(s) I’ve made, the diff tool is
    >>> invaluable, e.g.
    >>>
    >>> diff -u /etc/ssh/sshd_config{-orig,}
    >>> ...
    >>> and try automatically applying the same change to the new installation
    >>> using patch:
    >>>
    >>> diff -u /home/backup/old_system/etc/config_file{-orig,} | patch
    >>>

    >> Better, IMO, gvimdiff (or vimdiff if no gui); the syntax of several
    >> config files is recognized, and the colouring speeds comprehension.

    >
    > Can it apply a difference as a patch as well?
    >

    It seems to me that this "Windows Registry" thing is a rip-off of GConf:

    "GConf involves a few new concepts, but no rocket science. Essentially
    GConf provides a preferences database, which is like a simple
    filesystem. The filesystem contains keys organized into a hierarchy.
    Each key is either a directory containing more keys, or has a value."

    Cheers,

    Cliff

    --

    The ends justifies the means - Niccolò di Bernardo dei Machiavelli.

    The end excuses any evil - Sophocles
    Enkidu, Apr 18, 2010
    #10
  11. Lawrence D'Oliveiro

    Enkidu Guest

    Lawrence D'Oliveiro wrote:
    > In message <bc27bfba-d389-4cbe-
    > >, John Little wrote:
    >
    >> But why diff two files (say, x and x.orig) to generate a patch that is
    >> used to make them the same?

    >
    > No, I want to diff two files to create a patch for a third file. Given
    >
    > A - default config file for old system version
    > B - customized config file for old system version
    > C - default config file for new system version
    >
    > I want to apply the difference between A and B to C to create
    >
    > D - customized config file for new system version
    >

    man vimdiff

    Apparently it can handle up to four files.

    Cheers,

    Cliff

    --

    The ends justifies the means - Niccolò di Bernardo dei Machiavelli.

    The end excuses any evil - Sophocles
    Enkidu, Apr 18, 2010
    #11
  12. Lawrence D'Oliveiro

    John Little Guest

    On Apr 18, 6:01 pm, Enkidu <> wrote:

    > man vimdiff


    In all my years of using vim, I'd never thought of looking for man
    pages; vim's internal help is so good.

    (Don't mind me hijacking Lawrence's *nix evangelism for a spot of the
    same for vim. We have similar motives.)

    Regards, John
    John Little, Apr 18, 2010
    #12
  13. Lawrence D'Oliveiro

    John Little Guest

    On Apr 18, 5:43 pm, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    .....

    > D - customized config file for new system version


    Thank you, I get it now. Hmm, maybe a slightly rash approach. Sounds
    like the situation versioning systems are for: if one changes a config
    file, put it in a repository and create a branch for the change, and
    when a new version arrives, merge the branches. Again, a tool set
    applicable to text-based config files.

    Regards, John
    John Little, Apr 18, 2010
    #13
  14. On 16 Apr, 23:02, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    > In message
    > <>, David
    >
    > Goodwin wrote:
    > > The registry does have its advantages though. A nice standard clean
    > > tidy way of storing structured configuration data.

    >
    > Yeah, “standard” and “clean” are the first two words that come to mind when
    > you think of the Windows Registry ... along with “so easy to {721922F4-
    > DA0B-4A27-807C-CB08CC3F5F1A} a child could {B3833833-40A3-475C-8290-
    > B91954E7E85D} it”, “efficient”, “reliable”, “{0C03692B-
    > EE17-4AF6-92CE-45312CB1E384}” and “never ever a cause of system slowdown let
    > alone complete failure, no {B3833833-40A3-475C-8290-B91954E7E85D} sirree”
    > ...


    thats all under HKCR - its file type associations, etc. Its rarely
    touched. HKLM\Software\Cygwin\setup\rootdir = "C:\cygwin" is plenty
    clean and tidy. No need to parse some random file format.

    > > It makes it very easy to write a program which manages the configuration
    > > data - like a control panel or something.

    >
    > Wonder why PowerShell makes it look like a filesystem made up of lots of
    > little files, then...


    because its a convenient way to access it from a shell?
    David Goodwin, Apr 18, 2010
    #14
  15. Lawrence D'Oliveiro

    Enkidu Guest

    John Little wrote:
    > On Apr 18, 6:01 pm, Enkidu <> wrote:
    >
    >> man vimdiff

    >
    > In all my years of using vim, I'd never thought of looking for man
    > pages; vim's internal help is so good.
    >

    You reckon? I don't use it because I find it so confusing. A quick
    Google with the appropriate terms is much quicker.

    Cheers,

    Cliff

    --

    The ends justifies the means - Niccolò di Bernardo dei Machiavelli.

    The end excuses any evil - Sophocles
    Enkidu, Apr 18, 2010
    #15
  16. In message <>, Allistar wrote:

    > This is one of the reasons I like Gentoo - the etc-update command handles
    > this for you, and provides you with the flexibility of a more discrete
    > config file merge if you want.


    My experience is Gentoo is no different from Debian in this respect.
    Lawrence D'Oliveiro, Apr 19, 2010
    #16
  17. In message
    <>, David
    Goodwin wrote:

    > On 16 Apr, 23:02, Lawrence D'Oliveiro <_zealand>
    > wrote:
    >
    >> In message
    >> <>,
    >> David Goodwin wrote:
    >>>
    >>> The registry does have its advantages though. A nice standard clean

    > > tidy way of storing structured configuration data.
    >>
    >> Yeah, “standard†and “clean†are the first two words that come to mind
    >> when you think of the Windows Registry ... along with “so easy to
    >> {721922F4- DA0B-4A27-807C-CB08CC3F5F1A} a child could
    >> {B3833833-40A3-475C-8290- B91954E7E85D} itâ€, “efficientâ€, “reliableâ€,
    >> “{0C03692B- EE17-4AF6-92CE-45312CB1E384}†and “never ever a cause of
    >> system slowdown let alone complete failure, no
    >> {B3833833-40A3-475C-8290-B91954E7E85D} sirree†...

    >
    > thats all under HKCR - its file type associations, etc. Its rarely
    > touched.


    Really?? Then what about those “God Mode†long incomprehensible hex strings
    that were making the rounds a few months back, and being eagerly copied by
    the Dimdows enthusiasts around here?

    Or how about this
    <http://groups.google.co.nz/group/nz.comp/msg/41b31e1caf765ebf>?

    >>> It makes it very easy to write a program which manages the
    >>> configuration data - like a control panel or something.


    If it’s so easy, then why still so much need to edit the Registry? (Over
    3600 hits for
    <http://www.google.com/search?q=%22type+regedit%22+site:support.microsoft.com>.)

    >> Wonder why PowerShell makes it look like a filesystem made up of lots of
    >> little files, then...

    >
    > because its a convenient way to access it from a shell?


    Only from a shell? Not from any other programming environment? What’s so
    special about PowerShell in this regard, considering it’s supposed to be
    object-oriented?
    Lawrence D'Oliveiro, Apr 19, 2010
    #17
  18. Lawrence D'Oliveiro

    Sweetpea Guest

    On Sun, 18 Apr 2010 13:47:42 -0700, David Goodwin wrote:

    >> Goodwin wrote:
    >> > The registry does have its advantages though. A nice standard clean
    >> > tidy way of storing structured configuration data.


    LOL!

    And so reliable too - no need for 5 separate backup copies of the registry sitting on a production file
    system nosiree! And without any doubt M$ Windows is the most secure and most reliable OS ever sol...
    err... licensed since electric computers were invented.

    And you believe that???!


    --
    "Filtering the Internet is like trying to boil the ocean"
    Sweetpea, Apr 19, 2010
    #18
  19. On 19 Apr, 15:46, Lawrence D'Oliveiro <l...@geek-
    central.gen.new_zealand> wrote:
    > In message
    > <>, David
    >
    >
    >
    > Goodwin wrote:
    > > On 16 Apr, 23:02, Lawrence D'Oliveiro <_zealand>
    > > wrote:

    >
    > >> In message
    > >> <>,
    > >> David Goodwin wrote:

    >
    > >>> The registry does have its advantages though. A nice standard clean
    > > > tidy way of storing structured configuration data.

    >
    > >> Yeah, “standard” and “clean” are the first two words that come to mind
    > >> when you think of the Windows Registry ... along with “so easy to
    > >> {721922F4- DA0B-4A27-807C-CB08CC3F5F1A} a child could
    > >> {B3833833-40A3-475C-8290- B91954E7E85D} it”, “efficient”, “reliable”,
    > >> “{0C03692B- EE17-4AF6-92CE-45312CB1E384}” and “never ever a cause of
    > >> system slowdown let alone complete failure, no
    > >> {B3833833-40A3-475C-8290-B91954E7E85D} sirree” ...

    >
    > > thats all under HKCR - its file type associations, etc. Its rarely
    > > touched.

    >
    > Really?? Then what about those “God Mode” long incomprehensible hex strings
    > that were making the rounds a few months back, and being eagerly copied by
    > the Dimdows enthusiasts around here?


    Those are called Class IDs. They are a shell extension system. They
    are used to implement such icons as Recycle Bin, My Documents,
    Internet Explorer and My Computer. Nice and flexible eh? Stick a UUID
    into the registry with the appropriate details and create a file or
    directory with the appropriate name. This stuff isn't intended to be
    touched by the end user.

    But this is irrelevant. I said the registry is a nice clean tidy way
    of storing structured configuration data. I never said anything about
    what individual programs such as the windows shell store in it.

    > Or how about this
    > <http://groups.google.co.nz/group/nz.comp/msg/41b31e1caf765ebf>?
    >
    > >>> It makes it very easy to write a program which manages the
    > >>> configuration data - like a control panel or something.

    >
    > If it’s so easy, then why still so much need to edit the Registry? (Over
    > 3600 hits for
    > <http://www.google.com/search?q=%22type+regedit%22+site:support.micros....>.)
    >
    > >> Wonder why PowerShell makes it look like a filesystem made up of lots of
    > >> little files, then...

    >
    > > because its a convenient way to access it from a shell?

    >
    > Only from a shell? Not from any other programming environment? What’s so
    > special about PowerShell in this regard, considering it’s supposed to be
    > object-oriented?


    I believe PowerShell is intended as a system administration utility.
    Having some regedit-like functionality built-in would be useful.

    there is no real need to provide a filesystem view of the registry to
    anything else - the windows API works fine.
    David Goodwin, Apr 19, 2010
    #19
  20. In article <-september.org>, Dave Doe <> wrote:
    (snip)
    >Ubuntu 10.04 beta 1 (beta 2 is out, release not far off, parties started
    >:) - is a release where the nvidia drivers have been seriously sorted
    >out. It's the only Ubuntu I've been able to run and get a stable screen
    >resolution (every other older version kept dropping back from 1024.768
    >to 800.600 or 640.480!). All by itself.


    I've had no obvious video problems with kubuntu 7.10 and nvidia drivers,
    other than occasional lock ups when using wine. Perhaps my failing to
    upgrade was a good thing. :)
    Bruce Sinclair, Apr 20, 2010
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U29mdFNwb3Q=?=

    Building SQL for Numeric Value in Text Field

    =?Utf-8?B?U29mdFNwb3Q=?=, Sep 18, 2004, in forum: MCSD
    Replies:
    1
    Views:
    915
    Guest
    Sep 18, 2004
  2. uv2003
    Replies:
    4
    Views:
    618
    =?Utf-8?B?U2Vhbg==?=
    Jun 23, 2005
  3. philip007
    Replies:
    1
    Views:
    598
    jcottingim
    Jan 31, 2006
  4. JF Mezei
    Replies:
    1
    Views:
    879
    Doug McIntyre
    May 22, 2007
  5. charset
    Replies:
    4
    Views:
    486
    Stephen
    May 28, 2008
Loading...

Share This Page