Loading ...
Sorry, an error occurred while loading the content.

Re: [gnubies-il] why tar and not cp -a

Expand Messages
  • Shlomi Fish
    ... I can think of a reason why serialize/deserializing things will not always yield the best results. For example, if you have a view on a different object,
    Message 1 of 2 , Oct 29, 2000
    • 0 Attachment
      On Sun, 29 Oct 2000, stephen s fine wrote:

      > here is one answer why tar is prefered-from the IGLU archives.I am
      > still working on the -p option
      >
      > On Sun, 28 May 2000, Omer Mussaev wrote:
      >
      > > > Any reason why not to use cp -a that I'm not aware of?
      > >
      > > first: using tar is POSIX compliant, thus you can use tar method on
      > > any POSIX(applications) compliant machine.
      > > second: this is the Unix way.
      >
      > Let me add my own reason for why I like the tar|tar trick better: it's
      > standard. No, not in UNIX: in programmer think. You know what the
      > standard
      > way is to copy objects in Java? Why, serialize/deserialize. You know
      > what
      > the standard way is to copy objects in Python? Why, pickle/unpickle.
      > The *correct* way to copy in a pointer-isomorphic way, is by a
      > serialize/deserialize mechanism. But that's *exactly* the meaning of
      > tar.
      >

      I can think of a reason why serialize/deserializing things will not
      always yield the best results. For example, if you have a view on a
      different object, and you want to create another view that will initially
      be identical, then the serializing/deserializing mechanism will create a
      similiar view with an entirely different source object. And that's not
      what you wanted to accomplish...

      Generally, duplicating an object is a very vague operation with different
      meanings even when it comes to the same object. I am at the moment working
      on a relatively large perl API called Gamla (http://gamla.iglu.org.il/).
      I coded its base class and decided against it having a duplicate method
      for exactly that reason. I just didn't want my classes to have a standard
      API function which the user wouldn't know what it does exactly.

      But that's a discussion for hackers-il not gnubies-il. Anyway, I would
      still choose the "cp -a" method, unless I really had to write something
      that is cross-platform enough as to not use GNU cp. The reason for that is
      that I consider it safer than a monstrous tar - | (cd $dir ; tar
      -) pipeline. Even in perl it's usually not a wise idea to use Data::Dumper
      and then eval twice, which if I understood correctly is the equivalent of
      a serialize/deserialize stuff. ;-)

      Shlomi Fish







      > --
      > Moshe Zadka <moshez@...>
      > http://www.oreilly.com/news/prescod_0300.html
      > http://www.linux.org.il -- we put the penguin in .com
      >
      >
      >
      >
      >
      > To unsubscribe from this group, send an email to:
      > gnubies-il-unsubscribe@egroups.com
      >
      >
      >
      >



      ----------------------------------------------------------------------
      Shlomi Fish shlomif@...
      Home Page: http://t2.technion.ac.il/~shlomif/
      Home E-mail: shlomif@...

      The prefix "God Said" has the extraordinary logical property of
      converting any statement that follows it into a true one.
    Your message has been successfully submitted and would be delivered to recipients shortly.