Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileout package creates two files and an extra extension .gs.gs #260

Closed
ericwinger opened this issue Mar 6, 2025 · 3 comments
Closed

fileout package creates two files and an extra extension .gs.gs #260

ericwinger opened this issue Mar 6, 2025 · 3 comments
Assignees
Labels
P3-Problem Bug that should be fixed, but not critical

Comments

@ericwinger
Copy link
Member

@LisaAlmarode reports:

When I file out a package, I get an empty [packagename.gs](http://packagename.gs/) and another file named [packagename.gs.gs](http://packagename.gs.gs/) with the contents.

@dalehenrich has a proposed fix by conditionalizing the code in JfP

Thinking about the package fileout discussion (cannot preserve non .gs file) and I realize that a solution would be to conditionalize the code in JfP to strip the extension from the filename for pre 3.4.0 versions of Rowan and a new implementation where  Rowan would strip and preserve the extension if there is one on the filename ... the GemStone code for testing if Rowan is 3.4.0 (3.7.3.1) or later would look like the following:
Rowan version >= (RwSemanticVersionNumber fromString: '3.4.0')
  ifTrue: [ "no need to strip extension" ]
  ifFalse: [ "use old api and strip extension"]
I think that this is a perfectly good solution ... and probably won't be the last time we will need to do something like this as long as we're sharing Jadeite across multiple GemStone versions ...

Fix needs to happen in RCS method: RowanPackageService>>exportTopazFormatTo:

@ericwinger ericwinger added the P3-Problem Bug that should be fixed, but not critical label Mar 6, 2025
@ericwinger ericwinger self-assigned this Mar 6, 2025
ericwinger added a commit that referenced this issue Mar 6, 2025
#262 - set current walkback scenario fixed - JfP wasn't clearing commandArgs. 
#260 - strip .gs extension prevents .gs.gs extension problem.  
Tests for both added. 

Additional service class tests added. Renamed test class. 
Fix for #test_importConnection.  connectionProfile singleton was being replaced in the code but test still looked at old instance. 
Removed unsent method. 

#262
#260
@ericwinger
Copy link
Member Author

.gs stripped in package fileout now. Rowan fix needed for extra file problem.

ericwinger added a commit to GemTalk/RowanClientServices that referenced this issue Mar 6, 2025
Strip .gs extension in package fileout
GemTalk/JadeiteForPharo#260
@dalehenrich
Copy link
Member

This turns out to be an issue with FileReference>>isWritable. FileReference>>isWritable unconditionally creates a zero length file in order determine if the file is writable or not ... I looks as though Pharo may have the same implementation as GemStone, so this isn't necessarily a GemStone bug.

The solution is to perform the isWriteAble test when the final full file name is known (including the extension). This is the test code I used to finally understand (and solve) the issue:

	| rwProject filePath packageName  projectName  massagedFilePath fileRef |
	projectName := 'Rowan'.
	packageName := 'Rowan-Tools-OnlyV2'.
	filePath := '/bosch1/users/dhenrich/_stones/37x/f_37x_externals_st/', packageName.
	filePath := '/bosch1/users/dhenrich/_stones/37x/f_37x_externals_st/', packageName, '.gs'.
	rwProject := (RowanProjectService new name: projectName) rwProject.
	fileRef := filePath asFileReference.
	massagedFilePath := filePath asFileReference extension = 'gs'
				ifTrue: [ fileRef withoutExtension pathString ]
				ifFalse: [ fileRef pathString ] .
	(massagedFilePath, '.gs') asFileReference isWritable
		ifFalse: [ ^ self warn: 'File is not writable. Permissions problem?' ].
	rwProject
		exportTopazFormatTo: massagedFilePath
		logClassCreation: false
		excludeClassInitializers: false
		excludeRemoveAllMethods: false
		usingPackageNamesMap:
			(Dictionary new
				at: massagedFilePath put: {packageName};
				yourself)

ericwinger added a commit to GemTalk/RowanClientServices that referenced this issue Mar 7, 2025
Dale discovered isWriteable was creatin the extra file. Now send isWriteable to the massaged file.
GemTalk/JadeiteForPharo#260
@ericwinger
Copy link
Member Author

Should be fixed using Dale's recommendation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3-Problem Bug that should be fixed, but not critical
Projects
None yet
Development

No branches or pull requests

2 participants