[sword-devel] 1.7.5a1

Isaac Dunham ibid.ag at gmail.com
Sat Jan 23 22:48:53 MST 2016


On Fri, Aug 21, 2015 at 12:08:48AM -0400, Greg Hellings wrote:
> Developers and other interested parties,
> 
> I've created a tarball and an SVN tag for SWORD 1.7.5a1. Please test
> it and let me know if there are issues. If I hear nothing or only
> positive feedback, I'll bless the same tarball as the final 1.7.5
> release.
> 
> http://crosswire.org/ftpmirror/pub/sword/source/v1.7/sword-1.7.5a1.tar.gz

A bug that I've referred to before but not sent the patch for
(an omission for which I must apologize):

Platform:	Alpine Linux, any musl-based release
SWORD versions:	1.7.x, possibly 1.8.x
Symptoms:
When 'installmgr -r <Repo>' issues the standard warning, it seemingly hangs
after the line ending "...then type yes at the prompt".
After typing in a response ending in a newline, the prompt shows up.
Cause:
cout (at least on this platform) is essentially an alternate way of writing
to stdout, which is supposed to be line-buffered by default.
Here, this means that if you want to display a partial line (no newline),
you need to flush cout after writing it, or the line will just
sit in the buffer.

grepping through utilities/, I see that genbookutil.cpp has a few spots
that should hit the same bug.

Here's a patch for those issues.

Thank you and God bless,
Isaac Dunham

-------------- next part --------------
diff --git a/utilities/genbookutil.cpp b/utilities/genbookutil.cpp
index 71363e3..c78f58f 100644
--- a/utilities/genbookutil.cpp
+++ b/utilities/genbookutil.cpp
@@ -59,7 +59,7 @@ void printLocalName(TreeKeyIdx *treeKey) {
 
 void setLocalName(TreeKeyIdx *treeKey) {
 	char buf[1023];
-	std::cout << "Enter New Node Name: ";
+	std::cout << "Enter New Node Name: " << flush;
 	fgets(buf, 1000, stdin);
 	SWBuf name = buf;
 	treeKey->setLocalName(name.trim());
@@ -69,7 +69,7 @@ void setLocalName(TreeKeyIdx *treeKey) {
 
 void gotoPath(TreeKeyIdx *treeKey) {
 	char buf[1023];
-	std::cout << "Enter Path: ";
+	std::cout << "Enter Path: " << flush;
 	fgets(buf, 1000, stdin);
 	SWBuf path = buf;
 	(*treeKey) = path.trim();
@@ -78,7 +78,7 @@ void gotoPath(TreeKeyIdx *treeKey) {
 
 void assurePath(TreeKeyIdx *treeKey) {
 	char buf[1023];
-	std::cout << "Enter Path: ";
+	std::cout << "Enter Path: " << flush;
 	fgets(buf, 1000, stdin);
 	SWBuf path = buf;
 	treeKey->assureKeyPath(path.trim());
@@ -117,7 +117,7 @@ void setEntryText(RawGenBook *book) {
 void appendSibbling(TreeKeyIdx *treeKey) {
 	if (treeKey->getOffset()) {
 		char buf[1023];
-		std::cout << "Enter New Sibbling Name: ";
+		std::cout << "Enter New Sibbling Name: " << flush;
 		fgets(buf, 1000, stdin);
 		SWBuf name = buf;
 		treeKey->append();
@@ -176,7 +176,7 @@ int main(int argc, char **argv) {
 	char line[1024];
 
 	do {
-		std::cout << "[" << treeKey->getText() << "] > ";
+		std::cout << "[" << treeKey->getText() << "] > " << flush;
 		fgets(line, 1000, stdin);
 		input = line;
 		input.trim();
diff --git a/utilities/installmgr.cpp b/utilities/installmgr.cpp
index b705c25..3e53d84 100644
--- a/utilities/installmgr.cpp
+++ b/utilities/installmgr.cpp
@@ -72,7 +72,7 @@ virtual bool isUserDisclaimerConfirmed() const {
 		cout << "cannot be held responsible for their content. CAVEAT EMPTOR.\n\n\n";
 		cout << "If you understand this and are willing to enable remote source features\n";
 		cout << "then type yes at the prompt\n\n";
-		cout << "enable? [no] ";
+		cout << "enable? [no] " << flush;
 
 		char prompt[10];
 		fgets(prompt, 9, stdin);


More information about the sword-devel mailing list