[SERVER-31077] do not attempt to save history to a blank filename Created: 13/Sep/17  Updated: 06/Dec/22  Resolved: 01/Jun/21

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial - P5
Reporter: Eric Milkie Assignee: Backlog - Security Team
Resolution: Won't Fix Votes: 0
Labels: move-sa, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-40693 Mongo shell should surface errors fro... Closed
Related
is related to SERVER-44490 The mongo command connecting mongodb ... Closed
Assigned Teams:
Server Security
Participants:
Case:

 Description   

As part of exit handling, the shell always calls shellHistoryDone(). However, there are some code paths that do not hit shellHistoryInit(); for such runs of the shell, the shell will output this message on exit:

2017-09-13T10:30:28.490-0400 E -        [main] Error saving history file: FileOpenFailed: Unable to open() file : No such file or directory

I can reproduce this by running the shell with this command and then pressing CTRL-C:

 ./mongo --nodb --eval "sleep(5000)" 



 Comments   
Comment by Nic Cottrell [ 24/Apr/19 ]

I can also reproduce with a `temp.js` file with contents

sleep(5000)

 and launched with:

mongo --nodb temp.js    

Generated at Thu Feb 08 04:25:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.