WARNING: vi & crypt on OSR6 - SCO

This is a discussion on WARNING: vi & crypt on OSR6 - SCO ; I've been thru a few versions of SCO thru the years, and have used vi to write a few billion scripts. Occasionally, I accidentally use ":X" (uppercase 'X') to write and exit which would prompt for a encryption key -- ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: WARNING: vi & crypt on OSR6

  1. WARNING: vi & crypt on OSR6

    I've been thru a few versions of SCO thru the years, and have used vi
    to write a few billion scripts. Occasionally, I accidentally use ":X"
    (uppercase 'X') to write and exit which would prompt for a encryption
    key -- but I've never had a system with the crypt command installed so
    the encryption failed.

    Well..I was writing a script today and accidentally used "X" to write
    and save. I have no idea what I typed in, but I found the file
    encrypted when I reopened it. lol. funny stuff!

    I fixed the "problem" by renaming the crypt command to crypt-

    I'm wondering if any other commands will be NEEDING the missing crypt
    command?


  2. Re: WARNING: vi & crypt on OSR6

    In article <1157258932.535103.184410@e3g2000cwe.googlegroups.c om>,
    XeniXman wrote:
    >I've been thru a few versions of SCO thru the years, and have used vi
    >to write a few billion scripts. Occasionally, I accidentally use ":X"
    >(uppercase 'X') to write and exit which would prompt for a encryption
    >key -- but I've never had a system with the crypt command installed so
    >the encryption failed.
    >
    >Well..I was writing a script today and accidentally used "X" to write
    >and save. I have no idea what I typed in, but I found the file
    >encrypted when I reopened it. lol. funny stuff!
    >
    >I fixed the "problem" by renaming the crypt command to crypt-
    >
    >I'm wondering if any other commands will be NEEDING the missing crypt
    >command?


    Don't know about that, but I learned years ago to never exit vi
    with anything but :wq or :q or :q!

    That's because years ago some of the short cuts, such as 'zz' often
    didn't write things properly, or failed to write when you thought
    it did.

    And when I was supporting systems that had their own semi-trained
    admins, I'd find many that would look at their files with vi
    and then use zz to exit.

    When I'd go in to look I'd ask "what changes did you make on
    " and I get an answer 'nothing'. I finally got them to
    use 'less' or 'view' [the RO version of vi.

    I still use vi for everything but the only time I ever got spooked
    was shend my finger missed the v and I hit the c, so I executed
    'ci", and when I exited I couldn't find my file. I found it
    with the comma v at the end, and proceeded to fix that.

    The problem as unix grows larger and larger is that so often a
    simple typo will execute something that you wish NOT to occur.

    Bill
    --
    Bill Vermillion - bv @ wjv . com

  3. Re: WARNING: vi & crypt on OSR6

    On Sun, Sep 03, 2006, Bill Vermillion wrote:
    >In article <1157258932.535103.184410@e3g2000cwe.googlegroups.c om>,
    >XeniXman wrote:
    >>I've been thru a few versions of SCO thru the years, and have used vi
    >>to write a few billion scripts. Occasionally, I accidentally use ":X"
    >>(uppercase 'X') to write and exit which would prompt for a encryption
    >>key -- but I've never had a system with the crypt command installed so
    >>the encryption failed.
    >>
    >>Well..I was writing a script today and accidentally used "X" to write
    >>and save. I have no idea what I typed in, but I found the file
    >>encrypted when I reopened it. lol. funny stuff!
    >>
    >>I fixed the "problem" by renaming the crypt command to crypt-
    >>
    >>I'm wondering if any other commands will be NEEDING the missing crypt
    >>command?

    >
    >Don't know about that, but I learned years ago to never exit vi
    >with anything but :wq or :q or :q!
    >
    >That's because years ago some of the short cuts, such as 'zz' often
    >didn't write things properly, or failed to write when you thought
    >it did.


    I've never seen that particular problem, but have often seen students press
    instead of ZZ, putting the vi job in background, then wondering
    what happened. Often they would have multiple copies of vi editing the
    same file, with most of them in background (less a problem with vim as it
    will complain about the swap file it creates).

    I played with this a bit yesterday on a SuSE Linux Enterprise 9 system, but
    couldn't get it to encrypt the file. On the other hand, when asking for
    encryption, it does ask for the password twice so it seems to me that it
    would be difficult to accidentally shoot myself in the foot (and it didn't
    encrypt the file).

    Bill
    --
    INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC
    URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
    FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676

    Many companies that have made themselves dependent on [the equipment of a
    certain major manufacturer] (and in doing so have sold their soul to the
    devil) will collapse under the sheer weight of the unmastered complexity of
    their data processing systems.
    -- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5

  4. Re: WARNING: vi & crypt on OSR6

    Bill Vermillion wrote:

    > Don't know about that, but I learned years ago to never exit vi
    > with anything but :wq or :q or :q!
    >
    > That's because years ago some of the short cuts, such as 'zz' often
    > didn't write things properly, or failed to write when you thought
    > it did.


    OSR5 `vi` does have this problem, as follows. "ZZ" means "write this
    buffer out, if it is dirty". Suppose you are editing a file and, just
    before exiting, you decide to write it somewhere else. For instance you
    might be replying to some email, so you're editing a file with a name
    like "/tmp/.eda000Ek". You suddenly realize that this is a very
    important reply that needs to be saved somewhere else, so you do:

    :w ~/save/important.reply
    ZZ

    The problem is, the ":w" command resets the "buffer is dirty" flag.
    After ":w", the buffer isn't dirty -- it's been written somewhere. Of
    course if you made some small change after ":w", the "ZZ" would write.
    But in this scenario you didn't do so. So "ZZ" exits without writing
    and without any error message -- just as it would have done if you had
    looked at an existing file and made no changes.

    I've been bitten by this several times over the years, but I still use
    "ZZ". I now have a mental model of the dirty-buffer flag and I remember
    to use ":w!" instead of "ZZ" immediately after ":w some-other-file".

    I'm pretty sure `vim` solves this by having a slightly better model of
    buffer dirtiness. It knows whether a buffer is dirty _relative to the
    original file from which the buffer came_. Even immediately after ":w
    some-other-file", the current buffer is dirty relative to the original
    filename. So "ZZ" writes it.

    If you do make this mistake with OSR5 `vi`, at least it is the case that
    you just wrote the contents somewhere else, and can probably recover
    them from there. The only likely exceptions to that would be if you did
    something like ":w /dev/null", which clears the "dirty" flag without
    leaving behind a usable copy...

    >Bela<


  5. Re: WARNING: vi & crypt on OSR6

    In article <200609031521.aa05237@deepthought.armory.com>,
    Bela Lubkin wrote:
    >Bill Vermillion wrote:


    >> Don't know about that, but I learned years ago to never exit vi
    >> with anything but :wq or :q or :q!


    >> That's because years ago some of the short cuts, such as 'zz' often
    >> didn't write things properly, or failed to write when you thought
    >> it did.


    >OSR5 `vi` does have this problem, as follows. "ZZ" means "write this
    >buffer out, if it is dirty". Suppose you are editing a file and, just
    >before exiting, you decide to write it somewhere else. For instance you
    >might be replying to some email, so you're editing a file with a name
    >like "/tmp/.eda000Ek". You suddenly realize that this is a very
    >important reply that needs to be saved somewhere else, so you do:


    > :w ~/save/important.reply
    > ZZ


    >The problem is, the ":w" command resets the "buffer is dirty" flag.
    >After ":w", the buffer isn't dirty -- it's been written somewhere. Of
    >course if you made some small change after ":w", the "ZZ" would write.
    >But in this scenario you didn't do so. So "ZZ" exits without writing
    >and without any error message -- just as it would have done if you had
    >looked at an existing file and made no changes.


    >I've been bitten by this several times over the years, but I still use
    >"ZZ". I now have a mental model of the dirty-buffer flag and I remember
    >to use ":w!" instead of "ZZ" immediately after ":w some-other-file".


    Thanks for explaining how/why this happens. I think that's a good
    reason not to use ZZ for many people - as so many people don't use
    their tools often enough to remember the 'gotchas' they need to
    watch out for.

    >I'm pretty sure `vim` solves this by having a slightly better model of
    >buffer dirtiness. It knows whether a buffer is dirty _relative to the
    >original file from which the buffer came_. Even immediately after ":w
    >some-other-file", the current buffer is dirty relative to the original
    >filename. So "ZZ" writes it.


    I've never particularly cared for vim. It's just enough different
    from the vi [and variants] I've used since '83 to make it less than
    I'd like. I do remember the first V.3 I used not on SCO where I
    could edit large files that I could not on SCO. But that got fixed
    years ago. I currently used 'nvi' from FreeBSD. It's based on the
    original - and I understand the original code had gotten lost.

    ;version on the command line shows this

    Version 1.79 (10/23/96) The CSRG, University of California, Berkeley

    Last major modification and contact person shows Keith Bostic, with
    scads of contrbutors at CSRG and prior.

    >If you do make this mistake with OSR5 `vi`, at least it is the
    >case that you just wrote the contents somewhere else, and can
    >probably recover them from there. The only likely exceptions to
    >that would be if you did something like ":w /dev/null", which
    >clears the "dirty" flag without leaving behind a usable copy...


    Thanks for all the info.

    Bill
    --
    Bill Vermillion - bv @ wjv . com

+ Reply to Thread