a07f02977c359fe3bda4dd0893e76d3cf3c498f2 markd Sat Nov 23 18:45:00 2024 -0800 improved hgsql error message when hg.conf is missing. Simplified error message to remove internal and inccorect details. #20323 diff --git src/hg/lib/sqlProg.c src/hg/lib/sqlProg.c index 320404b..3899992 100644 --- src/hg/lib/sqlProg.c +++ src/hg/lib/sqlProg.c @@ -123,33 +123,33 @@ // SYSCONFDIR/my.cnf should be next, but I do not think it matters. maybe it is just /var/lib/mysql anyways. safef(path, sizeof path, "%s/my.cnf", getenv("MYSQL_HOME")); copyCnfToDefaultsFile(path, defaultFileName, fileNo); safef(path, sizeof path, "%s/.my.cnf", getenv("HOME")); copyCnfToDefaultsFile(path, defaultFileName, fileNo); /* write out the group name, user, host, and password */ safef(paddedGroup, sizeof(paddedGroup), "[%s]\n", group); if (write (fileNo, paddedGroup, strlen(paddedGroup)) == -1) errAbort("Writing group to temporary file %s failed with errno %d", defaultFileName, errno); char *settings = sqlProfileToMyCnf(profile); if (!settings) - errAbort("Could not connect to MySQL. Profile '%s.*' not found in sqlProfileToMyCnf() -- failed for file '%s' with errno %d. " - "Most likely the statements %s.host, %s.user and %s.password are missing in ~/.hg.conf or (...)/cgi-bin/hg.conf.", - profile, defaultFileName, errno, profile, profile, profile); + errAbort("Could not connect to MySQL. Profile '%s.*' not found. " + "Most likely the statements %s.host, %s.user and %s.password are missing in ~/.hg.conf or (...)/cgi-bin/hg.conf or the conf file was not found", + profile, profile, profile, profile); if (sameString(prog, "mysqldump")) { // need to suppress the database setting, it messes up mysqldump and is not needed. comment it out settings = replaceChars(settings, "\ndatabase=", "\n#database="); } if (write (fileNo, settings, strlen(settings)) == -1) errAbort("Writing profile '%s' settings=[%s] as my.cnf format failed for file '%s' failed with errno %d", profile, settings, defaultFileName, errno); return fileNo; } void sqlExecProg(char *prog, char **progArgs, int userArgc, char *userArgv[]) /* Exec one of the sql programs using user and password from ~/.hg.conf. * progArgs is NULL-terminate array of program-specific arguments to add,