Skip to content

Commit 6d15e4f

Browse files
committed
BF: CS-663 In a default installation on Google Cloud the hostname length is too long for commands
1 parent f2eacee commit 6d15e4f

34 files changed

+92
-107
lines changed

source/clients/qacct/ocs_qacct.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
290290
if (*(argv[ii+1])=='-') {
291291
options.hostflag = 1;
292292
} else {
293-
char unique[CL_MAXHOSTLEN];
293+
char unique[CL_MAXHOSTNAMELEN + 1];
294294
lList *answer_list = nullptr;
295295
gdi_client_prepare_enroll(&answer_list);
296296
if (getuniquehostname(argv[++ii], unique, 0) != CL_RETVAL_OK) {

source/clients/qhost/ocs_qhost_print.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static int
285285
sge_print_host(lListElem *hep, lList *centry_list, qhost_report_handler_t *report_handler, lList **alpp, u_long32 show)
286286
{
287287
lListElem *lep;
288-
char *s, host_print[CL_MAXHOSTLEN+1] = "";
288+
char *s, host_print[CL_MAXHOSTNAMELEN+1] = "";
289289
const char *host;
290290
char load_avg[20], mem_total[20], mem_used[20], swap_total[20],
291291
swap_used[20], num_proc[20], socket[20], core[20], arch_string[80], thread[20];
@@ -303,7 +303,7 @@ sge_print_host(lListElem *hep, lList *centry_list, qhost_report_handler_t *repor
303303
host = lGetHost(hep, EH_name);
304304

305305
/* cut away domain in case of ignore_fqdn */
306-
sge_strlcpy(host_print, host, CL_MAXHOSTLEN);
306+
sge_strlcpy(host_print, host, CL_MAXHOSTNAMELEN);
307307
if (ignore_fqdn && (s = strchr(host_print, '.'))) {
308308
*s = '\0';
309309
}

source/daemons/qmaster/configuration_qmaster.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ sge_read_configuration(const lListElem *aSpoolContext, lList **config_list, lLis
218218
int
219219
sge_del_configuration(sge_gdi_packet_class_t *packet, sge_gdi_task_class_t *task, lListElem *aConf, lList **anAnswer, char *aUser, char *aHost) {
220220
const char *tmp_name = nullptr;
221-
char unique_name[CL_MAXHOSTLEN];
221+
char unique_name[CL_MAXHOSTNAMELEN];
222222
int ret = -1;
223223

224224
DENTER(TOP_LAYER);
@@ -238,7 +238,7 @@ sge_del_configuration(sge_gdi_packet_class_t *packet, sge_gdi_task_class_t *task
238238
/*
239239
* Due to CR 6319231 IZ 1760:
240240
* try to resolve the hostname
241-
* if it is not resolveable then
241+
* if it is not resolvable then
242242
* ignore this and use the hostname stored in the configuration obj
243243
* or use the given name if no object can be found
244244
*/
@@ -315,7 +315,7 @@ int
315315
sge_mod_configuration(lListElem *aConf, lList **anAnswer, const char *aUser, const char *aHost, u_long64 gdi_session) {
316316
lListElem *old_conf;
317317
const char *tmp_name = nullptr;
318-
char unique_name[CL_MAXHOSTLEN];
318+
char unique_name[CL_MAXHOSTNAMELEN];
319319
int ret = -1;
320320
const char *cell_root = bootstrap_get_cell_root();
321321
const char *qualified_hostname = component_get_qualified_hostname();
@@ -730,7 +730,7 @@ static u_long32
730730
sge_get_config_version_for_host(const char *aName) {
731731
const lListElem *conf = nullptr;
732732
u_long32 version = 0;
733-
char unique_name[CL_MAXHOSTLEN];
733+
char unique_name[CL_MAXHOSTNAMELEN];
734734
int ret = -1;
735735
const lList *config_list = *ocs::DataStore::get_master_list(SGE_TYPE_CONFIG);
736736

@@ -743,7 +743,7 @@ sge_get_config_version_for_host(const char *aName) {
743743
/*
744744
* Due to CR 6319231 IZ 1760:
745745
* Try to resolve the hostname
746-
* if it is not resolveable then
746+
* if it is not resolvable then
747747
* ignore this and use the given hostname
748748
*/
749749
ret = sge_resolve_hostname(aName, unique_name, EH_name);
@@ -772,7 +772,7 @@ sge_get_config_version_for_host(const char *aName) {
772772
lListElem *
773773
sge_get_configuration_for_host(const char *aName) {
774774
lListElem *conf = nullptr;
775-
char unique_name[CL_MAXHOSTLEN];
775+
char unique_name[CL_MAXHOSTNAMELEN];
776776
int ret = -1;
777777
const lList *config_list = *ocs::DataStore::get_master_list(SGE_TYPE_CONFIG);
778778

@@ -783,7 +783,7 @@ sge_get_configuration_for_host(const char *aName) {
783783
/*
784784
* Due to CR 6319231 IZ 1760:
785785
* Try to resolve the hostname
786-
* if it is not resolveable then
786+
* if it is not resolvable then
787787
* ignore this and use the given hostname
788788
*/
789789
ret = sge_resolve_hostname(aName, unique_name, EH_name);

source/daemons/qmaster/sge_host_qmaster.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ int sge_del_host(sge_gdi_packet_class_t *packet, sge_gdi_task_class_t *task, lLi
258258
int pos;
259259
lListElem *ep;
260260
const char *host;
261-
char unique[CL_MAXHOSTLEN];
261+
char unique[CL_MAXHOSTNAMELEN];
262262
lList **host_list = nullptr;
263263
int nm = 0;
264264
const char *name = nullptr;
@@ -1019,7 +1019,7 @@ master_kill_execds(sge_gdi_packet_class_t *packet, sge_gdi_task_class_t *task) {
10191019
int kill_jobs;
10201020
lListElem *lel;
10211021
const lListElem *rep;
1022-
char host[CL_MAXHOSTLEN];
1022+
char host[CL_MAXHOSTNAMELEN];
10231023
const char *hostname;
10241024
lList *master_ehost_list = *ocs::DataStore::get_master_list_rw(SGE_TYPE_EXECHOST);
10251025

source/daemons/qmaster/sge_qmaster_heartbeat.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ increment_heartbeat(te_event_t anEvent, monitoring_t *monitor)
122122
int retval = 0;
123123
int heartbeat = 0;
124124
int check_act_qmaster_file = 0;
125-
char act_qmaster_name[CL_MAXHOSTLEN];
126-
char act_resolved_qmaster_name[CL_MAXHOSTLEN];
125+
char act_qmaster_name[CL_MAXHOSTNAMELEN];
126+
char act_resolved_qmaster_name[CL_MAXHOSTNAMELEN];
127127
char err_str[SGE_PATH_MAX+128];
128128
const char *act_qmaster_file = bootstrap_get_act_qmaster_file();
129129
const char *qualified_hostname = component_get_qualified_hostname();

source/daemons/qmaster/sge_utility_qmaster.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ cqueue_mod_sublist(lListElem *this_elem, lList **answer_list, lListElem *reduced
775775
*/
776776
for_each_rw(mod_elem, mod_list) {
777777
const char *name = lGetHost(mod_elem, sublist_host_name);
778-
char resolved_name[CL_MAXHOSTLEN + 1];
778+
char resolved_name[CL_MAXHOSTNAMELEN + 1];
779779
lListElem *org_elem = nullptr;
780780

781781
if (name == nullptr) {

source/dist/util/install_modules/inst_common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,9 +1078,9 @@ CheckConfigFile()
10781078

10791079
if [ "$EXECD" = "uninstall" ]; then
10801080
if [ -z "$EXEC_HOST_LIST_RM" ]; then
1081-
$INFOTEXT -e "Your >EXEC_HOST_LIST_RM< is empty or not resolveable!"
1081+
$INFOTEXT -e "Your >EXEC_HOST_LIST_RM< is empty or not resolvable!"
10821082
$INFOTEXT -e "For a automatic execd unintallation you have to enter a valid exechost name!"
1083-
$INFOTEXT -log "Your >EXEC_HOST_LIST_RM< is empty or not resolveable!"
1083+
$INFOTEXT -log "Your >EXEC_HOST_LIST_RM< is empty or not resolvable!"
10841084
$INFOTEXT -log "For a automatic execd unintallation you have to enter a valid exechost name!"
10851085
is_valid="false"
10861086
fi

source/libs/comm/cl_commlib.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ bool cl_com_setup_commlib_complete() {
589589
return setup_complete;
590590
}
591591

592-
/* the cl_com_get_(un)resolveable_hosts functions don't need a mutex,
592+
/* the cl_com_get_(un)resolvable_hosts functions don't need a mutex,
593593
* because the memory is malloced in cl_com_setup_commlib()
594594
* and freed in cl_com_cleanup_commlib()
595595
*/
@@ -7637,15 +7637,15 @@ int getuniquehostname(const char *hostin, char *hostout, int refresh_aliases) {
76377637
}
76387638
ret_val = cl_com_cached_gethostbyname((char *) hostin, &resolved_host, nullptr, nullptr, nullptr);
76397639
if (resolved_host != nullptr) {
7640-
if (strlen(resolved_host) >= CL_MAXHOSTLEN) {
7640+
if (strlen(resolved_host) >= CL_MAXHOSTNAMELEN) {
76417641
char tmp_buffer[1024];
76427642
snprintf(tmp_buffer, 1024, MSG_CL_COMMLIB_HOSTNAME_EXEEDS_MAX_HOSTNAME_LENGTH_SU,
7643-
resolved_host, sge_u32c(CL_MAXHOSTLEN));
7643+
resolved_host, sge_u32c(CL_MAXHOSTNAMELEN));
76447644
cl_commlib_push_application_error(CL_LOG_ERROR, CL_RETVAL_HOSTNAME_LENGTH_ERROR, tmp_buffer);
76457645
sge_free(&resolved_host);
76467646
return CL_RETVAL_HOSTNAME_LENGTH_ERROR;
76477647
}
7648-
snprintf(hostout, CL_MAXHOSTLEN, "%s", resolved_host);
7648+
snprintf(hostout, CL_MAXHOSTNAMELEN, "%s", resolved_host);
76497649
sge_free(&resolved_host);
76507650
}
76517651
return ret_val;

source/libs/comm/cl_commlib.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,6 @@ cl_commlib_get_last_message_time(cl_com_handle_t *handle, const char *un_resolve
259259
#define COMMD_NACK_CONFLICT CL_RETVAL_ENDPOINT_NOT_UNIQUE
260260
#define CL_FIRST_FREE_EC 32
261261

262-
#ifndef CL_MAXHOSTLEN
263-
#define CL_MAXHOSTLEN CL_MAXHOSTNAMELEN_LENGTH /* TODO: remove this define */
264-
#endif
265-
266262
int getuniquehostname(const char *hostin, char *hostout, int refresh_aliases);
267263

268264
cl_raw_list_t * cl_com_get_thread_list();

source/libs/comm/cl_communication.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,10 +1598,10 @@ char *cl_com_get_h_error_string(int h_error) {
15981598
int cl_com_gethostname(char **unique_hostname, struct in_addr *copy_addr, struct hostent **he_copy,
15991599
int *system_error_value) { /* CR check */
16001600

1601-
char localhostname[CL_MAXHOSTNAMELEN_LENGTH + 1];
1601+
char localhostname[CL_MAXHOSTNAMELEN + 1];
16021602

16031603
errno = 0;
1604-
if (gethostname(localhostname, CL_MAXHOSTNAMELEN_LENGTH) != 0) {
1604+
if (gethostname(localhostname, CL_MAXHOSTNAMELEN) != 0) {
16051605
if (system_error_value != nullptr) {
16061606
*system_error_value = errno;
16071607
}
@@ -2277,7 +2277,7 @@ int cl_com_read_alias_file(cl_raw_list_t *hostlist) {
22772277
char alias_file_buffer[LINE_MAX * 4];
22782278
int max_line = LINE_MAX * 4;
22792279
const char *alias_delemiters = "\n\t ,;";
2280-
char printbuf[(2 * CL_MAXHOSTLEN) + 100];
2280+
char printbuf[(2 * CL_MAXHOSTNAMELEN) + 100];
22812281

22822282
if (hostlist == nullptr) {
22832283
return CL_RETVAL_PARAMS;
@@ -2341,7 +2341,7 @@ int cl_com_read_alias_file(cl_raw_list_t *hostlist) {
23412341
return CL_RETVAL_MALLOC;
23422342
}
23432343
} else {
2344-
CL_LOG_STR(CL_LOG_ERROR, "mainname in alias file is not resolveable:", help);
2344+
CL_LOG_STR(CL_LOG_ERROR, "mainname in alias file is not resolvable:", help);
23452345
continue;
23462346
}
23472347
while (cl_com_remove_host_alias(main_name) == CL_RETVAL_OK);
@@ -2714,7 +2714,7 @@ int cl_com_cached_gethostbyaddr(struct in_addr *addr, char **unique_hostname, st
27142714

27152715
if (elem_host != nullptr) {
27162716
if (elem_host->resolved_name == nullptr) {
2717-
CL_LOG(CL_LOG_INFO, "found addr in cache - not resolveable");
2717+
CL_LOG(CL_LOG_INFO, "found addr in cache - not resolvable");
27182718
cl_raw_list_unlock(hostlist);
27192719
return CL_RETVAL_GETHOSTADDR_ERROR;
27202720
}

0 commit comments

Comments
 (0)