Thread: I lost the Source Code

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Question I lost the Source Code

    I had a C progam that was designed for us by a consultant. We had a source code and an executable. The source code was temporarily placed in temp fodler (/tmp) of a Unix box. The source code was lost when the Unix box was restarted. I was told that there is not way it can be recovered. I have some changes that i want to do but because I only have the executable, It is a problem. The consultant who did the code is late.... no one has the source code. Is there a way I can convert the executable to a source code?? Or any help I can get??

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > The source code was temporarily placed in temp fodler (/tmp) of a Unix box
    So where did it come from? It didn't spontaneously appear there, it must have been copied from somewhere else.

    Eg.
    From: Consultant
    To: you
    Subject: code
    Find attached a TAR file with the source code.

    So check your email archives.

    Or maybe even a CD, or a thumb drive, or an FTP site or your mail hosting ISP or ....

    > Is there a way I can convert the executable to a source code?
    It's usually quicker to rewrite it from scratch, unless you're also interested in legacy preserving bugs in the old version.
    Whilst you can decompile code, the result isn't anything you would want to maintain. It CERTAINLY won't look like the original code.


    > I was told that there is not way it can be recovered.
    Well that depends on how much time has elapsed since the reboot, and the amount of use of the machine. If you've only just done this, there is a reasonable chance that the data is still on the disk (data sectors will only be overwritten when next allocated for storage).
    Reboot, mount the disk read-only and make a clone copy of the disk.
    But the longer you leave this option, the less likely you will find your files with a disk sector search.


    Linux Ext2fs Undeletion mini-HOWTO
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Um...some type of SCM that you back up each night might be in order. If you have it I cannot believe you did not submit the project the instant you downloaded it. But as Salem has suggested I'm sure the consultant has some type of SCM and if you paid for the code then just ask them to re-send it.

  4. #4
    Registered User
    Join Date
    Aug 2010
    Posts
    3

    Question I lost the Source Code

    Thanks gys,

    The consultant came and retrieved if from his gmail account. We did not have it saved on any media. He was an individual consultant, no partners/co-workers. Like I said, he passed away last year and there is no how we can find his files.

    This unix box is used as a test box. We only edit the script, compile and ftp the compiled file to production. Unfortunately, we do not back-up any data/info contained in this box.

    I will very much want to try the last option given by Salem. I am not much familiar with Unix OS. How best can I do this Reboot and cloning??

    Once again, thanks for your help.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    We did not have it saved on any media.
    Then I guess this is one painful lesson you won't soon forget.

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Quote Originally Posted by onalethata
    I will very much want to try the last option given by Salem. I am not much familiar with Unix OS. How best can I do this Reboot and cloning??
    Salem also provided a link.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Aug 2010
    Posts
    3
    Sorry, I found the link after posting the reply. Will go through the doceument.

    Thank All,

  8. #8
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by Salem View Post
    > I was told that there is not way it can be recovered.
    Well that depends on how much time has elapsed since the reboot, and the amount of use of the machine. If you've only just done this, there is a reasonable chance that the data is still on the disk (data sectors will only be overwritten when next allocated for storage).
    Reboot, mount the disk read-only and make a clone copy of the disk.
    But the longer you leave this option, the less likely you will find your files with a disk sector search.


    Linux Ext2fs Undeletion mini-HOWTO
    Hmmm it depends also on how /tmp is mounted. I believe that usually or at least sometimes it's stored in memory rather than disk. Not always though. If it was stored in memory, it's completely gone.
    Try "mount" on the server and copy the line that has /tmp, if any. If none, then you might be able to recover it.

  9. #9
    Registered User
    Join Date
    Nov 2010
    Posts
    1
    I can try to help you to reverse engineer what you have.
    CONUS.INFO

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Closed.

    Please don't bump old threads.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do you call another source code file?
    By nifear4 in forum C Programming
    Replies: 2
    Last Post: 10-28-2008, 12:16 PM
  2. 'Type' Error on Build of Officially Released Source Code
    By Jedi_Mediator in forum C++ Programming
    Replies: 5
    Last Post: 07-07-2008, 05:28 PM
  3. starting linux's source code and kernel
    By sawer in forum Linux Programming
    Replies: 9
    Last Post: 08-01-2006, 07:46 AM
  4. DxEngine source code
    By Sang-drax in forum Game Programming
    Replies: 5
    Last Post: 06-26-2003, 05:50 PM
  5. Lines from Unix's source code have been copied into the heart of Linux????
    By zahid in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 05-19-2003, 03:50 PM

Tags for this Thread