Opened 9 years ago

Closed 7 years ago

#1220 closed change (fixed (in master))

Improve the -u switch

Reported by: magnate Owned by:
Milestone: 3.5.0 Keywords: loadsave
Cc:

Description (last modified by takkaria)

Currently the -u switch only looks in ANGBAND_DIR_SAVE, and ignores explicit paths, so

angband -mgcu -u/path/to/savefile

doesn't work. Plus, on Linux, it prepends the uid to the name, so

angband -mgcu -uChrisc

looks for 1000.Chrisc in ANGBAND_DIR_SAVE. This is way too inflexible - the argument following the -u needs to be interpreted as an explicit path and filename.

See also #150 and #1104.

Change History (8)

comment:1 follow-up: Changed 9 years ago by takkaria

it shouldn't on multi-user installs, but on others, sure.

comment:2 in reply to: ↑ 1 Changed 9 years ago by magnate

  • Description modified (diff)

Replying to takkaria:

it shouldn't on multi-user installs, but on others, sure.

I don't think I understand. It shouldn't parse a pathname on multi-user installs? Why not? If someone doesn't give a path then it should of course default to ANGBAND_DIR_SAVE, but why not allow them to specify a local path if they want?

Ah ... maybe you mean the old setgid approach where all the savefiles are not user-readable. Yes ok I can see that - we need to ignore any path in that scenario.

comment:3 Changed 9 years ago by magnate

  • Status changed from new to confirmed

comment:4 Changed 9 years ago by magnate

  • Type changed from bug to change

comment:5 Changed 9 years ago by takkaria

Technical notes:

The -u option doesn't actually set the 'savefile' global, but rather op_ptr->full_name, which is then processed with process_player_name(), which is a hacky mess. This is confusing and fixing it is a prerequisite for testing savefile saving and loading (#1303).

Suggestions to fix:

  • Replace process_player_name with a function that suggests a filename (not pathname) for a savefile, given the character's name
  • Move the code that deals with uid prefixes on savefiles to main.c where it belongs
  • Add a prompt for new characters with names that will overwrite old savefiles with the same name

comment:6 Changed 9 years ago by magnate

  • Milestone changed from 3.3.0 to Future

Punting in accordance with new milestone policy (that any other milestone is only set once someone is actually working on the ticket).

comment:7 Changed 7 years ago by takkaria

  • Description modified (diff)

OK, so part of this has been fixed - uid is no longer prepended on setgid systems. I'll look into the path thing now.

comment:8 Changed 7 years ago by takkaria

  • Milestone changed from Future to 3.5.0
  • Resolution set to fixed (in master)
  • Status changed from confirmed to closed

Fixed in f26fed2.

Note: See TracTickets for help on using tickets.