Community
Participate
Working Groups
When running the "Fix copyrights" tool against a Windows batch file something similar to the following gets added to the top of the file: rem ***************************************************************** rem Licensed Materials - Property of IBM rem (c) Copyright IBM Corporation 2006, 2008. All Rights Reserved. rem rem Note to U.S. Government Users Restricted Rights: rem Use, duplication or disclosure restricted by GSA ADP Schedule rem Contract with IBM Corp. rem ***************************************************************** Unfortunately, this gets echoed to the console when the batch file is executed. Please consider adopting one of the following alternatives: 1. Use "::" instead of "rem". Comments added with "::" are never echoed to the console. 2. Use "@rem" instead of "rem". The "@" character prevents the line from being echoed to the console. 3. Add "@echo off" as the first line to turn off echo. This is questionable, since the batch file might actually want echo to be ON, so you'd probably have to add "@each off" after the copyright rem statements. My vote is to use suggestion 1.
I haven't heard about the '::' method before and never seen it so far, is this officially documented by Microsoft? What version of Windows is required to understand it? I'd also like option 1 if it is "safe", otherwise option 2 looks good (I know for sure that @rem has been working ever since the earliest versions of Windows).
I think the minimum requirement for Windows Batchfiles is that if an existing correct Copyright is in the file with @REM or ::, the Fix Copyrights action must leave it intact -- but it prepends an IBM copyright, see bug 235572. Given that "Adding New Copyright" is much less frequent than just updating Copyright year, I'd consider bug 235572 more severe and would even think that if retaining a manually corrected copyright worked OK it were a reasonable workaround for the "rem prints..." issue.
One of the batch files I maintain used a "::" comment, and I had just assumed that this was an alternative to "rem", and until now, had not questioned it any further. It turns out to be a curious fluke that "::" works since ":" indicates a label, and the second ":" renders the label invalid. See http://www.robvanderwoude.com/comments.html. With this new information I would suggest that we don't use the "::" style of comments, since it could stop working one day, however unlikely. I want to change my vote to suggestion 2. <g>
Created attachment 137688 [details] Simple patch fixing the issue Attached simple patch fixes the issue. I used it successfully on my files.
Given that this patch just changes the String constants to be inserted, is anybody interested in pushing this into 3.5 ? I'd personally rather see it in 3.5.1, but on the other hand people need to update their copyrights NOW and they will need an updated version of the tool to do the best that the tool can do. One compromise might be committing the patch into HEAD but not release it, then people can get the tool from an N-build.
(In reply to comment #5) > I'd personally rather see it in 3.5.1, but on the other hand people need to > update their copyrights NOW and they will need an updated version of the tool > to do the best that the tool can do. It is pretty easy to install patched versions into your configuration: check out the project from CVS, apply any patch(es), and then Export>Plug-in Development>Deployable Plug-ins and Fragments>Install into Host.
The patch doesn't work for us, I'm afraid, because all of our batch files already have @echo off as the first line. So we do not want @rem... we just want rem. So the correct fix for this has to allow for the possibility that @echo off might be the first line of the file, and if it is, then don't output the @. Also, while you are in this area of the code <grin>, the original logic wasn't quite right for us, because the first line being @echo off made the copyright tool think that the batch file didn't have a copyright at all, so it added one... when in fact, the copyright was already there, but it needs to be after the first line of code.
The patch accepts rem as well as @rem and preserves what you currently have.
All your concerns are adressed already... try out and believe, or report any concrete issues you see :)
I tried it again, and you are correct - all of our batch files are correctly updated. I must have had a different patch earlier or maybe I was missing the patch from bug 235572 or something. So I am now fine with the patch in comment 4.
Patch released to 3.6 and 3.5.1 stream builds.