Bug 807630 - csprocessor complains about directory when *file* exists
csprocessor complains about directory when *file* exists
Status: CLOSED CURRENTRELEASE
Product: PressGang CCMS
Classification: Community
Component: CSProcessor (Show other bugs)
1.x
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Lee Newson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-28 07:34 EDT by Joshua Wulf
Modified: 2014-10-19 19:00 EDT (History)
2 users (show)

See Also:
Fixed In Version: 0.22.6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-06 21:31:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Joshua Wulf 2012-03-28 07:34:51 EDT
[jwulf@nitai scratch]$ csprocessor create Test_Book_Template 
CSProcessor client version: 0.22.5
Loading configuration from /home/jwulf/.config/csprocessor.ini
Connecting to Skynet server: http://skynet.usersys.redhat.com:8080/TopicIndex/

ERROR: A directory already exists for the Content Specification. Please check the "/home/jwulf/public_html/scratch/Test_Book_Template" directory first and if it's correct, then use the --force option.


Test_Book_Template exists, but is actually the content spec file that I'm checking in.

[jwulf@nitai scratch]$ ls
Content_Spec_Processor_2  Content_Spec_Processor_2~  Content_Spec_Processor_Guide  Docbook+RDFa  Existing_Content_Spec  Existing_Content_Spec_Tutorial  Test_Book_Template


Not sure if there is a strategy to deal with this situation (other than telling people to name the content spec something else - or perhaps the Name[+1] approach); but maybe csprocessor could check if it's in fact a file or a directory and give an appropriate error.

Suggestion: 
"A file named Test_Book_Template exists here. You could move this file, or execute this command in another directory."

"A directory named Test_Book_Template already exists here. You could move this directory, execute this command in another directory, or overwrite the Test_Book_Template directory using the --force option."

cspclient-0.22.5-1.noarch
OS: Fedora release 16 (Verne)

JAVA: java version "1.7.0_b147-icedtea"
OpenJDK Runtime Environment (fedora-2.1.fc16.1-x86_64)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)
Comment 1 Lee Newson 2012-03-28 19:17:38 EDT
Fixed in 0.22.6

Really you should be using identifying methods (ie filename extensions) but none the less I've done a fix.

Cause:
The check wasn't checking if the output was a file or a directory.

Consequence:
An error message would be displayed on the create command if a file existed that had the same name as the output directory.

Fix:
Make the check see if the output is a file or a directory. If its a directory print the error message, otherwise continue with the normal processing.

Note: there is no need to print an error message if the file exists. it is only relevant for directories.
Comment 2 Lee Newson 2013-06-06 21:31:35 EDT
Closing and setting as current release as no QA was performed by the original reporter. If there is still an issue with this bug still than please re-open it.

Note You need to log in before you can comment on or make changes to this bug.