• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Really odd FTP issue"

Collapse

  • woody1
    replied
    Originally posted by NickFitz View Post

    It sounds like the destination file is being opened for writing, but never closed. That would leave it hanging and presumably the OS would eventually close the open file handle but without any awareness of what had been done to it. This could, in theory, leave the content on disk having been overwritten but the file descriptor not having been told the new length of the file. Then the file would have the new content at the start but have the same length as the old file from the point of view of whatever reads it.
    I've never seen UNIX doing anything like this but I guess you never know.

    As an experiment, I would try the same FTP transfers (small text file overwriting large text file) from the UNIX server to itself (ie. using the UNIX FTP client). This would take the Windows side of things out of the equation altogether.
    Last edited by woody1; 13 July 2024, 08:03.

    Leave a comment:


  • NickFitz
    replied
    Originally posted by WTFH View Post

    No, nothing special around row 50 - we've tried with other file sizes and it is just overwriting the new data as far as it needs to in the file.
    It sounds like the destination file is being opened for writing, but never closed. That would leave it hanging and presumably the OS would eventually close the open file handle but without any awareness of what had been done to it. This could, in theory, leave the content on disk having been overwritten but the file descriptor not having been told the new length of the file. Then the file would have the new content at the start but have the same length as the old file from the point of view of whatever reads it.

    Originally posted by WTFH View Post
    The people that the data is going to have now discovered that the new file has its original header and the new header as well.
    This also makes it sound like the file modification is happening but being left hanging. But by this point, I'd be demanding hex dumps of individual disk sectors so I could see what was really going on

    Originally posted by WTFH View Post
    I wonder if we can send a Delete before we send the next file, or maybe move/rename the previous file when we send the new one.
    That might work but if it's what I suggest, then fixing the sending FTP client to properly close the file (or the receiving one to do so if it's their fault) would resolve the issue by making things work properly, which is better than a clumsy and haphazard "fix" that seems to work and does… for now

    Leave a comment:


  • b0redom
    replied
    Not seen this before. I wonder if it's the windows client 'restarting' the file transfer. TBH though, knowingly overwriting a file is bad practice operationally. If you think you might need it, make a backup, if you don't remove it as soon as it's done. Either of those are trivial using cron.

    Leave a comment:


  • woody1
    replied
    Originally posted by WTFH View Post

    No, nothing special around row 50 - we've tried with other file sizes and it is just overwriting the new data as far as it needs to in the file.
    The people that the data is going to have now discovered that the new file has its original header and the new header as well.
    Even more bizarre. I can't imagine it being an FTP server configuration option because who would want this behaviour.

    Which UNIX is it? Sun, HP, Linux?

    Leave a comment:


  • NotAllThere
    replied
    FTP rename for old file
    FTP send for new file

    Leave a comment:


  • WTFH
    replied
    Originally posted by woody1 View Post

    Weird. Never seen this before, nor could I find this issue with Google.

    As an experiment, it might be worth changing mode (binary/ascii) to see if this changes the behaviour.

    -----------

    I'd also use od (-a or -c) to examine the file on the UNIX side to see if there's anything odd around row 50.
    No, nothing special around row 50 - we've tried with other file sizes and it is just overwriting the new data as far as it needs to in the file.
    The people that the data is going to have now discovered that the new file has its original header and the new header as well.
    I wonder if we can send a Delete before we send the next file, or maybe move/rename the previous file when we send the new one.

    Leave a comment:


  • woody1
    replied
    Originally posted by WTFH View Post

    It’s going from Windows to UNIX, using built-in FTP.
    Weird. Never seen this before, nor could I find this issue with Google.

    As an experiment, it might be worth changing mode (binary/ascii) to see if this changes the behaviour.

    -----------

    I'd also use od (-a or -c) to examine the file on the UNIX side to see if there's anything odd around row 50.
    Last edited by woody1; 11 July 2024, 06:32.

    Leave a comment:


  • hobnob
    replied
    Make sure that you're using binary mode to transfer the file. If you use ASCII mode, Windows and Unix handle line breaks differently (CR+LF on Windows, LF only on Unix). I haven't seen it cause this particular issue, but I have seen it cause corrupted files before.

    Leave a comment:


  • WTFH
    replied
    Originally posted by woody1 View Post
    As I recall, with UNIX, FTP put overwrites the file (same behaviour as cp/copy). Which OS is this, and is it built-in FTP or 3rd party?
    It’s going from Windows to UNIX, using built-in FTP.

    Leave a comment:


  • woody1
    replied
    As I recall, with UNIX, FTP put overwrites the file (same behaviour as cp/copy). Which OS is this, and is it built-in FTP or 3rd party?

    Leave a comment:


  • eek
    replied
    Originally posted by WTFH View Post
    I've just been asked about a really odd FTP issue.
    A text file is created on one server and then FTP'd to another.
    The next day a new file is created with the same name and FTP'd across.

    Here is the problem: The new file does not replace the old one, but seems to be overwriting the data in it.
    That wouldn't be a problem if the new file was always bigger than the old one, but if the new file is smaller in size than the old one, then you see the e.g. 50 rows of the new file, and row 51 onwards is actually row 51 onwards of the old file.

    Any thoughts?
    You've got a dodgy FTP client which is opening the existing file rather than deleting it and starting afresh...

    Leave a comment:


  • WTFH
    started a topic Really odd FTP issue

    Really odd FTP issue

    I've just been asked about a really odd FTP issue.
    A text file is created on one server and then FTP'd to another.
    The next day a new file is created with the same name and FTP'd across.

    Here is the problem: The new file does not replace the old one, but seems to be overwriting the data in it.
    That wouldn't be a problem if the new file was always bigger than the old one, but if the new file is smaller in size than the old one, then you see the e.g. 50 rows of the new file, and row 51 onwards is actually row 51 onwards of the old file.

    Any thoughts?

Working...
X