This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 30112 - CVS add/import doesn't add binary file as binary - corrupt when retrieved
Summary: CVS add/import doesn't add binary file as binary - corrupt when retrieved
Status: RESOLVED DUPLICATE of bug 71196
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: CVS (show other bugs)
Version: 3.x
Hardware: All All
: P1 blocker with 1 vote (vote)
Assignee: Martin Entlicher
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2003-01-15 00:55 UTC by Walter Loew
Modified: 2007-01-04 17:14 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Walter Loew 2003-01-15 00:55:59 UTC
This is being entered as a P1 bug because it involves 
corruption of stored files.

It was tested on Q build code tagged QBE200301080100, 
using the built-in cvs client.

There are two cases:

1.  A MultiDataObject has an "important" secondary file 
that is a binary file that doesn't have an obvious binary 
extension. A CVS add/commit is done on the DO.

2.  A directory contains a binary file that doesn't have 
an obvious binary extension and a CVS add/commit is done 
on the directory with "Add Recursively" checked.

In each of these cases the un-obvious binary file will not 
be stored with -kb and will be corrupt when fetched.

One way to reproduce:

1. Take a zip-format file and rename it to "x.x".  This 
will be an un-obvious binary file.

2. Put the file into a new directory, and do a CVS 
add/commit of the directory, with "Add Recursively" 
checked.

3. Checksum x.x in the working directory.

4. Do "status -v" on x.x to see there's no -kb.

5. Delete x.x in the working directory.

6. Do a CVS update of the directory, re-fetching x.x.

7. Re-checksum x.x in the working directory.
Comment 1 Martin Entlicher 2003-01-15 13:04:14 UTC
Walter, this is a known limitation of the VCS support in NetBeans. It
does not recognize whether the files are textual or binary, if they
are unknown to NetBeans. You have to solve it in your version control
system.
When you do "cvs add" on a command-line, it also adds the file as text
and corrupts it's structure. So our GUI is consistent with the CVS
behavior and thus it can not be a defect.

But I agree, that this can cause troubles to novice users, who do not
know how important is the proper distinction of textual and binary
files. A lot of CVS users do not know, that it's important to tell to
the CVS explicitly which files you would like to keep in binary mode
before you start adding them into the repository. The IDE should help
them to assure, that they will not loose their files.

So, I'm changing this to ENHANCEMENT with the P1 priority.

Is there some proofed way how to detect which file is binary and which
is text? I've created a simple detection based on occurrence of
characters whose value is less than 32 (ignoring '\n', '\r', '\t' and
'\f') some time ago. It worked well for common files. Can this be
considered as a sufficient test?
Comment 2 dmladek 2003-02-20 14:24:59 UTC
>2Walter:
>>A MultiDataObject has an "important" secondary file 
>>that is a binary file that doesn't have an obvious >>binary 
>>extension. A CVS add/commit is done on the DO.

I think that good solution would be done through API:
MDO should provide such API that will give  information: which files
are binary

And then Martin woun't have make tests for those files which belong to
MDO.


But,
If this set of files (called MDO) wouldn't be known to IDE, then all
that files (in the set) wouldn't be a MDO and will be displayed
directly in the Explorer and you could handle them manualy.

And then we're back in the troubles...
>2Martin:
>Is there some proofed way how to detect which file is >binary and which
>is text?

And thus Martin would have to always (or at least for  the rest of
uknown FileObjects) perform his binary check.

So, I'm for to (move it) enter a new ENHANCEMENT to core/openide for
exptending current API.
It would IMHO, save PERFORMANCE, and Martin will implement his binary
check.



BTW: don't we have too many opened bugs for one 
thing? Please, see:
 issue #31056
 issue #21458

I suggest to mark 2 of them as duplicats for one of those 3
Comment 3 Martin Entlicher 2003-05-14 13:23:40 UTC
Scheduling for 4.0.
The same applies for Import.

The solution probably should be:
- if the file has text/... MIME type, add it as text
- if the file has other, but not unknown MIME type, add it as binary. This already works.
- if the file has unknown MIME type, ask the user whether this file should be considered as text or 
binary. The open question is, whether cvswrappers file should be checked before the user is asked.

I will not do an automatic detection. There's a description of why cvs does not do it from the cvs 
manual:

"There is currently no way to have CVS detect whether a file is binary based on its contents. The main 
difficulty with designing such a feature is that it is not clear how to distinguish between binary and 
non-binary files, and the rules to apply would vary considerably with the operating system."
Comment 4 seamans 2004-11-18 21:32:41 UTC
I'm having windows to Linux issuses along this line where the CR/LF
are being changed and JAR, GIF files are being corrupted.  Is there in
the CVS Options,  to make all files binary.

Jim
Comment 5 Maros Sandor 2005-08-05 16:10:46 UTC
New CVS provides easy way to select between text/binary method when committing
files.
Comment 6 sigalduek 2006-02-05 12:36:03 UTC
In NetBeans 5.0, when importing project into repository,the binary files
(.zip,.png,.gif,.jar etc) do not stored as binaries (-kb option).
Comment 7 Peter Pis 2006-02-05 14:54:47 UTC
This is the standard behaviour of import commmand for all cvs clients. It should
be a question of appropriate settings of CVS server ("cvswrappers" file in
CVSROOT). It will the best if cvs server decides how to treat the files. See
issue #71196.

*** This issue has been marked as a duplicate of 71196 ***